From 3da185a3c8f9999d487afa4a87307eb6c5787414 Mon Sep 17 00:00:00 2001 From: jsteube Date: Thu, 22 Sep 2016 15:20:24 +0200 Subject: [PATCH] Get rid of wordlist_mode variable in data. context --- include/hash_management.h | 4 ++-- include/types.h | 1 - include/weak_hash.h | 2 +- src/hash_management.c | 8 ++++---- src/hashcat.c | 4 +--- src/opencl.c | 2 +- src/weak_hash.c | 4 ++-- 7 files changed, 11 insertions(+), 14 deletions(-) diff --git a/include/hash_management.h b/include/hash_management.h index 9d656a06e..b2a97e765 100644 --- a/include/hash_management.h +++ b/include/hash_management.h @@ -13,9 +13,9 @@ int sort_by_hash_no_salt (const void *v1, const void *v2); void save_hash (const user_options_t *user_options, const hashconfig_t *hashconfig, const hashes_t *hashes); -void check_hash (opencl_ctx_t *opencl_ctx, hc_device_param_t *device_param, const user_options_t *user_options, plain_t *plain); +void check_hash (opencl_ctx_t *opencl_ctx, hc_device_param_t *device_param, const user_options_t *user_options, const user_options_extra_t *user_options_extra, plain_t *plain); -int check_cracked (opencl_ctx_t *opencl_ctx, hc_device_param_t *device_param, const user_options_t *user_options, hashconfig_t *hashconfig, hashes_t *hashes, const uint salt_pos); +int check_cracked (opencl_ctx_t *opencl_ctx, hc_device_param_t *device_param, const user_options_t *user_options, const user_options_extra_t *user_options_extra, hashconfig_t *hashconfig, hashes_t *hashes, const uint salt_pos); int hashes_init_stage1 (hashes_t *hashes, const hashconfig_t *hashconfig, potfile_ctx_t *potfile_ctx, outfile_ctx_t *outfile_ctx, user_options_t *user_options, char *hash_or_file); int hashes_init_stage2 (hashes_t *hashes, const hashconfig_t *hashconfig, opencl_ctx_t *opencl_ctx, user_options_t *user_options); diff --git a/include/types.h b/include/types.h index a0af2af97..50868ebdb 100644 --- a/include/types.h +++ b/include/types.h @@ -959,7 +959,6 @@ typedef struct char *mask; u32 maskcnt; u32 maskpos; - u32 wordlist_mode; char *eff_restore_file; char *new_restore_file; char *induction_directory; diff --git a/include/weak_hash.h b/include/weak_hash.h index daad58e9f..534d11ac6 100644 --- a/include/weak_hash.h +++ b/include/weak_hash.h @@ -6,6 +6,6 @@ #ifndef _WEAK_HASH_H #define _WEAK_HASH_H -void weak_hash_check (opencl_ctx_t *opencl_ctx, hc_device_param_t *device_param, const user_options_t *user_options, hashconfig_t *hashconfig, hashes_t *hashes, const uint salt_pos); +void weak_hash_check (opencl_ctx_t *opencl_ctx, hc_device_param_t *device_param, const user_options_t *user_options, const user_options_extra_t *user_options_extra, hashconfig_t *hashconfig, hashes_t *hashes, const uint salt_pos); #endif // _WEAK_HASH_H diff --git a/src/hash_management.c b/src/hash_management.c index 0538c636c..50767417e 100644 --- a/src/hash_management.c +++ b/src/hash_management.c @@ -219,7 +219,7 @@ void save_hash (const user_options_t *user_options, const hashconfig_t *hashconf unlink (old_hashfile); } -void check_hash (opencl_ctx_t *opencl_ctx, hc_device_param_t *device_param, const user_options_t *user_options, plain_t *plain) +void check_hash (opencl_ctx_t *opencl_ctx, hc_device_param_t *device_param, const user_options_t *user_options, const user_options_extra_t *user_options_extra, plain_t *plain) { debugfile_ctx_t *debugfile_ctx = data.debugfile_ctx; loopback_ctx_t *loopback_ctx = data.loopback_ctx; @@ -472,7 +472,7 @@ void check_hash (opencl_ctx_t *opencl_ctx, hc_device_param_t *device_param, cons outfile_write_close (outfile_ctx); - 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) && (user_options->status != true)) { @@ -503,7 +503,7 @@ void check_hash (opencl_ctx_t *opencl_ctx, hc_device_param_t *device_param, cons } } -int check_cracked (opencl_ctx_t *opencl_ctx, hc_device_param_t *device_param, const user_options_t *user_options, hashconfig_t *hashconfig, hashes_t *hashes, const uint salt_pos) +int check_cracked (opencl_ctx_t *opencl_ctx, hc_device_param_t *device_param, const user_options_t *user_options, const user_options_extra_t *user_options_extra, hashconfig_t *hashconfig, hashes_t *hashes, const uint salt_pos) { salt_t *salt_buf = &hashes->salts_buf[salt_pos]; @@ -567,7 +567,7 @@ int check_cracked (opencl_ctx_t *opencl_ctx, hc_device_param_t *device_param, co if (hashes->salts_done == hashes->salts_cnt) mycracked (opencl_ctx); - check_hash (opencl_ctx, device_param, user_options, &cracked[i]); + check_hash (opencl_ctx, device_param, user_options, user_options_extra, &cracked[i]); } hc_thread_mutex_unlock (mux_display); diff --git a/src/hashcat.c b/src/hashcat.c index bee9952ce..fb0f3d53e 100644 --- a/src/hashcat.c +++ b/src/hashcat.c @@ -276,8 +276,6 @@ int main (int argc, char **argv) data.hex_salt = user_options->hex_salt; data.logfile_disable = user_options->logfile_disable; data.quiet = user_options->quiet; - - data.wordlist_mode = user_options_extra->wordlist_mode; data.attack_kern = user_options_extra->attack_kern; } @@ -2586,7 +2584,7 @@ int main (int argc, char **argv) for (uint salt_pos = 0; salt_pos < hashes->salts_cnt; salt_pos++) { - weak_hash_check (opencl_ctx, device_param, user_options, hashconfig, hashes, salt_pos); + weak_hash_check (opencl_ctx, device_param, user_options, user_options_extra, hashconfig, hashes, salt_pos); } // Display hack, guarantee that there is at least one \r before real start diff --git a/src/opencl.c b/src/opencl.c index ea17a5e02..461cfeef4 100644 --- a/src/opencl.c +++ b/src/opencl.c @@ -1244,7 +1244,7 @@ int run_cracker (opencl_ctx_t *opencl_ctx, hc_device_param_t *device_param, hash if (user_options->benchmark == false) { - check_cracked (opencl_ctx, device_param, user_options, hashconfig, hashes, salt_pos); + check_cracked (opencl_ctx, device_param, user_options, user_options_extra, hashconfig, hashes, salt_pos); } /** diff --git a/src/weak_hash.c b/src/weak_hash.c index 4430659d2..1444f9972 100644 --- a/src/weak_hash.c +++ b/src/weak_hash.c @@ -30,7 +30,7 @@ extern hc_global_data_t data; -void weak_hash_check (opencl_ctx_t *opencl_ctx, hc_device_param_t *device_param, const user_options_t *user_options, hashconfig_t *hashconfig, hashes_t *hashes, const uint salt_pos) +void weak_hash_check (opencl_ctx_t *opencl_ctx, hc_device_param_t *device_param, const user_options_t *user_options, const user_options_extra_t *user_options_extra, hashconfig_t *hashconfig, hashes_t *hashes, const uint salt_pos) { if (device_param == NULL) { @@ -93,7 +93,7 @@ void weak_hash_check (opencl_ctx_t *opencl_ctx, hc_device_param_t *device_param, * result */ - check_cracked (opencl_ctx, device_param, user_options, hashconfig, hashes, salt_pos); + check_cracked (opencl_ctx, device_param, user_options, user_options_extra, hashconfig, hashes, salt_pos); /** * cleanup