diff --git a/include/induct.h b/include/induct.h index 4864494ed..fd296f4a8 100644 --- a/include/induct.h +++ b/include/induct.h @@ -12,9 +12,9 @@ static const char INDUCT_DIR[] = "induct"; -int induct_ctx_init (induct_ctx_t *induct_ctx, const user_options_t *user_options, const folder_config_t *folder_config, const status_ctx_t *status_ctx); -void induct_ctx_scan (induct_ctx_t *induct_ctx); -void induct_ctx_cleanup (induct_ctx_t *induct_ctx); -void induct_ctx_destroy (induct_ctx_t *induct_ctx); +int induct_ctx_init (hashcat_ctx_t *hashcat_ctx); +void induct_ctx_scan (hashcat_ctx_t *hashcat_ctx); +void induct_ctx_cleanup (hashcat_ctx_t *hashcat_ctx); +void induct_ctx_destroy (hashcat_ctx_t *hashcat_ctx); #endif // _INDUCT_H diff --git a/src/hashcat.c b/src/hashcat.c index 16ca49c02..40e3c2bbf 100644 --- a/src/hashcat.c +++ b/src/hashcat.c @@ -541,7 +541,7 @@ static int inner2_loop (hashcat_ctx_t *hashcat_ctx) if (induct_ctx->induction_dictionaries_cnt == 0) { - induct_ctx_scan (induct_ctx); + induct_ctx_scan (hashcat_ctx); while (induct_ctx->induction_dictionaries_cnt) { @@ -558,7 +558,7 @@ static int inner2_loop (hashcat_ctx_t *hashcat_ctx) myfree (induct_ctx->induction_dictionaries); - induct_ctx_scan (induct_ctx); + induct_ctx_scan (hashcat_ctx); } } @@ -1238,7 +1238,6 @@ int hashcat (hashcat_ctx_t *hashcat_ctx, char *install_folder, char *shared_fold dictstat_ctx_t *dictstat_ctx = hashcat_ctx->dictstat_ctx; folder_config_t *folder_config = hashcat_ctx->folder_config; - induct_ctx_t *induct_ctx = hashcat_ctx->induct_ctx; logfile_ctx_t *logfile_ctx = hashcat_ctx->logfile_ctx; loopback_ctx_t *loopback_ctx = hashcat_ctx->loopback_ctx; status_ctx_t *status_ctx = hashcat_ctx->status_ctx; @@ -1306,7 +1305,7 @@ int hashcat (hashcat_ctx_t *hashcat_ctx, char *install_folder, char *shared_fold * induction directory */ - const int rc_induct_ctx_init = induct_ctx_init (induct_ctx, user_options, folder_config, status_ctx); + const int rc_induct_ctx_init = induct_ctx_init (hashcat_ctx); if (rc_induct_ctx_init == -1) return -1; @@ -1499,7 +1498,7 @@ int hashcat (hashcat_ctx_t *hashcat_ctx, char *install_folder, char *shared_fold potfile_destroy (hashcat_ctx); - induct_ctx_destroy (induct_ctx); + induct_ctx_destroy (hashcat_ctx); outfile_destroy (hashcat_ctx); diff --git a/src/induct.c b/src/induct.c index 08e806909..61a0f454e 100644 --- a/src/induct.c +++ b/src/induct.c @@ -21,8 +21,13 @@ static int sort_by_mtime (const void *p1, const void *p2) return s2.st_mtime - s1.st_mtime; } -int induct_ctx_init (induct_ctx_t *induct_ctx, const user_options_t *user_options, const folder_config_t *folder_config, const status_ctx_t *status_ctx) +int induct_ctx_init (hashcat_ctx_t *hashcat_ctx) { + folder_config_t *folder_config = hashcat_ctx->folder_config; + induct_ctx_t *induct_ctx = hashcat_ctx->induct_ctx; + status_ctx_t *status_ctx = hashcat_ctx->status_ctx; + user_options_t *user_options = hashcat_ctx->user_options; + induct_ctx->enabled = false; if (user_options->benchmark == true) return 0; @@ -89,8 +94,10 @@ int induct_ctx_init (induct_ctx_t *induct_ctx, const user_options_t *user_option return 0; } -void induct_ctx_scan (induct_ctx_t *induct_ctx) +void induct_ctx_scan (hashcat_ctx_t *hashcat_ctx) { + induct_ctx_t *induct_ctx = hashcat_ctx->induct_ctx; + if (induct_ctx->enabled == false) return; induct_ctx->induction_dictionaries = scan_directory (induct_ctx->root_directory); @@ -100,8 +107,10 @@ void induct_ctx_scan (induct_ctx_t *induct_ctx) qsort (induct_ctx->induction_dictionaries, (size_t) induct_ctx->induction_dictionaries_cnt, sizeof (char *), sort_by_mtime); } -void induct_ctx_cleanup (induct_ctx_t *induct_ctx) +void induct_ctx_cleanup (hashcat_ctx_t *hashcat_ctx) { + induct_ctx_t *induct_ctx = hashcat_ctx->induct_ctx; + if (induct_ctx->enabled == false) return; for (int file_pos = 0; file_pos < induct_ctx->induction_dictionaries_cnt; file_pos++) @@ -115,8 +124,10 @@ void induct_ctx_cleanup (induct_ctx_t *induct_ctx) } } -void induct_ctx_destroy (induct_ctx_t *induct_ctx) +void induct_ctx_destroy (hashcat_ctx_t *hashcat_ctx) { + induct_ctx_t *induct_ctx = hashcat_ctx->induct_ctx; + if (induct_ctx->enabled == false) return; if (rmdir (induct_ctx->root_directory) == -1)