From 32d44a5f3ecb54d90c04102ec7ac7c6bb36c63e1 Mon Sep 17 00:00:00 2001 From: jsteube Date: Wed, 21 Sep 2016 21:07:57 +0200 Subject: [PATCH] Get rid of markov_disable, markov_classic, markov_threshold and markov_hcstat variable in main --- src/hashcat.c | 20 ++++---------------- src/user_options.c | 5 +++++ 2 files changed, 9 insertions(+), 16 deletions(-) diff --git a/src/hashcat.c b/src/hashcat.c index 5dde29406..126314ffd 100644 --- a/src/hashcat.c +++ b/src/hashcat.c @@ -401,10 +401,6 @@ int main (int argc, char **argv) // temporarily start - uint markov_disable = MARKOV_DISABLE; - uint markov_classic = MARKOV_CLASSIC; - uint markov_threshold = MARKOV_THRESHOLD; - char *markov_hcstat = NULL; char *outfile = NULL; uint outfile_format = OUTFILE_FORMAT; uint outfile_autohex = OUTFILE_AUTOHEX; @@ -426,10 +422,6 @@ int main (int argc, char **argv) if (1) { loopback = user_options->loopback; - markov_classic = user_options->markov_classic; - markov_disable = user_options->markov_disable; - markov_hcstat = user_options->markov_hcstat; - markov_threshold = user_options->markov_threshold; outfile_autohex = user_options->outfile_autohex; outfile_check_timer = user_options->outfile_check_timer; outfile_format = user_options->outfile_format; @@ -3071,9 +3063,7 @@ int main (int argc, char **argv) if (root_table_buf == NULL) root_table_buf = (hcstat_table_t *) mycalloc (SP_ROOT_CNT, sizeof (hcstat_table_t)); if (markov_table_buf == NULL) markov_table_buf = (hcstat_table_t *) mycalloc (SP_MARKOV_CNT, sizeof (hcstat_table_t)); - sp_setup_tbl (shared_dir, markov_hcstat, markov_disable, markov_classic, root_table_buf, markov_table_buf); - - markov_threshold = (markov_threshold != 0) ? markov_threshold : CHARSIZ; + sp_setup_tbl (shared_dir, user_options->markov_hcstat, user_options->markov_disable, user_options->markov_classic, root_table_buf, markov_table_buf); cs_t *root_css_buf = (cs_t *) mycalloc (SP_PW_MAX, sizeof (cs_t)); cs_t *markov_css_buf = (cs_t *) mycalloc (SP_PW_MAX * CHARSIZ, sizeof (cs_t)); @@ -3081,7 +3071,7 @@ int main (int argc, char **argv) data.root_css_buf = root_css_buf; data.markov_css_buf = markov_css_buf; - sp_tbl_to_css (root_table_buf, markov_table_buf, root_css_buf, markov_css_buf, markov_threshold, uniq_tbls); + sp_tbl_to_css (root_table_buf, markov_table_buf, root_css_buf, markov_css_buf, user_options->markov_threshold, uniq_tbls); data.combs_cnt = sp_get_sum (0, css_cnt, root_css_buf); @@ -3542,9 +3532,7 @@ int main (int argc, char **argv) if (root_table_buf == NULL) root_table_buf = (hcstat_table_t *) mycalloc (SP_ROOT_CNT, sizeof (hcstat_table_t)); if (markov_table_buf == NULL) markov_table_buf = (hcstat_table_t *) mycalloc (SP_MARKOV_CNT, sizeof (hcstat_table_t)); - sp_setup_tbl (shared_dir, markov_hcstat, markov_disable, markov_classic, root_table_buf, markov_table_buf); - - markov_threshold = (markov_threshold != 0) ? markov_threshold : CHARSIZ; + sp_setup_tbl (shared_dir, user_options->markov_hcstat, user_options->markov_disable, user_options->markov_classic, root_table_buf, markov_table_buf); cs_t *root_css_buf = (cs_t *) mycalloc (SP_PW_MAX, sizeof (cs_t)); cs_t *markov_css_buf = (cs_t *) mycalloc (SP_PW_MAX * CHARSIZ, sizeof (cs_t)); @@ -3552,7 +3540,7 @@ int main (int argc, char **argv) data.root_css_buf = root_css_buf; data.markov_css_buf = markov_css_buf; - sp_tbl_to_css (root_table_buf, markov_table_buf, root_css_buf, markov_css_buf, markov_threshold, uniq_tbls); + sp_tbl_to_css (root_table_buf, markov_table_buf, root_css_buf, markov_css_buf, user_options->markov_threshold, uniq_tbls); data.words_cnt = sp_get_sum (0, css_cnt, root_css_buf); diff --git a/src/user_options.c b/src/user_options.c index b7eed25c2..dcaaa9d22 100644 --- a/src/user_options.c +++ b/src/user_options.c @@ -348,6 +348,11 @@ int user_options_parse (user_options_t *user_options, int myargc, char **myargv) user_options->outfile_format_chgd = 1; } + if (user_options->markov_threshold == 0) + { + user_options->markov_threshold = 0x100; + } + return 0; }