>From 3b89ceb8bd1d157163300e5a90d30a8817d2a53b Mon Sep 17 00:00:00 2001 From: Frank Dittrich Date: Mon, 11 Jun 2012 12:01:19 +0200 Subject: [PATCH 2/2] use [Markov:Default] instead of [Options:Markov] for --markov --- doc/MARKOV | 22 +++++++++++++++++++++- run/john.conf | 17 ++++++++++------- src/mkv.c | 8 +++++--- src/params.h | 2 +- 4 files changed, 37 insertions(+), 12 deletions(-) diff --git a/doc/MARKOV b/doc/MARKOV index accbbc0..def07a3 100644 --- a/doc/MARKOV +++ b/doc/MARKOV @@ -74,11 +74,31 @@ proportionnal with the CPU's cracking speed. CONFIGURATION OPTIONS -New options are available in the john.conf file: +Default options for values not specified on the command line are available +in the john.conf file. +Unlike previous john versions which required these values to be specified +in the general [Options] section, starting from this version, these values +have to be specified in the [Markov:Default] secion. + +These are the values that can be specified: + Statsfile - This is the path of the "stat" file. + +Specifying a Statsfile in the [Markov:Default] section is mandatory +for Markov mode, because the Statsfile cannot be specified as a +command line parameter with --markov=. + MkvLvl - the default level + +MkvLvl should be specified in this section, as a fallback for the maximum +Markov level when using --markov (without any additional parameters) + MkvMaxLen - the default length +MkvMaxLen should also be specified in this section, as a fallback for the +maximum password length when using --markov (without any additional +parameters), --markov=, or similar options that don't include a +value for the password length. WHAT IS THE STAT FILE? The markov mode is based on statistical data from real passwords. This data is diff --git a/run/john.conf b/run/john.conf index ce497cf..077f3ad 100644 --- a/run/john.conf +++ b/run/john.conf @@ -61,13 +61,6 @@ CPstoreUTF8 = N LogCrackedPasswords = N -[Options:Markov] -# Default Markov mode settings -Statsfile = $JOHN/stats -MkvLvl = 200 -MkvMaxLen = 12 - - [Options:MPI] # Automagically disable OMP if MPI is used (set to N if # you want to run one MPI process per multi-core host) @@ -98,6 +91,16 @@ Device = 0 #cryptsha512_LWS = 64 #cryptsha512_GWS = 8192 +[Markov:Default] +# Default Markov mode settings +# Statsfile cannot be specified on the command line, so +# specifying it here is mandatory +Statsfile = $JOHN/stats +# MkvLvl and MkvMaxLen should also be specified here, as a fallback for +# --markov usage without specifying LEVEL and/or LENGTH on the command line +MkvLvl = 200 +MkvMaxLen = 12 + # A user defined character class is named with a single digit, ie. 0..9. After # the equal-sign, just list all characters that this class should match. You diff --git a/src/mkv.c b/src/mkv.c index ab87da2..dd43e24 100644 --- a/src/mkv.c +++ b/src/mkv.c @@ -37,6 +37,8 @@ #define LLd "%lld" #endif +#define SUBSECTION_DEFAULT "Default" + extern struct fmt_main fmt_LM; static long long tidx; @@ -304,7 +306,7 @@ void do_markov_crack(struct db_main *db, char * mkv_param) if(mkv_level == 0) - if( (mkv_level = cfg_get_int("Options", SUBSECTION_MARKOV, "MkvLvl")) == -1 ) + if( (mkv_level = cfg_get_int(SECTION_MARKOV, SUBSECTION_DEFAULT, "MkvLvl")) == -1 ) { log_event("no markov level defined!"); #ifdef HAVE_MPI @@ -315,7 +317,7 @@ void do_markov_crack(struct db_main *db, char * mkv_param) } if(mkv_maxlen == 0) - if( (mkv_maxlen = cfg_get_int("Options", SUBSECTION_MARKOV, "MkvMaxLen")) == -1 ) + if( (mkv_maxlen = cfg_get_int(SECTION_MARKOV, SUBSECTION_DEFAULT, "MkvMaxLen")) == -1 ) { log_event("no markov max length defined!"); #ifdef HAVE_MPI @@ -325,7 +327,7 @@ void do_markov_crack(struct db_main *db, char * mkv_param) error(); } - statfile = cfg_get_param("Options", SUBSECTION_MARKOV, "Statsfile"); + statfile = cfg_get_param(SECTION_MARKOV, SUBSECTION_DEFAULT, "Statsfile"); if(statfile == NULL) { log_event("statfile not defined"); diff --git a/src/params.h b/src/params.h index f11ed95..7ab1e64 100644 --- a/src/params.h +++ b/src/params.h @@ -163,13 +163,13 @@ * Configuration file section names. */ #define SECTION_OPTIONS "Options" -#define SUBSECTION_MARKOV ":Markov" #define SUBSECTION_MPI ":MPI" #define SECTION_RULES "List.Rules:" #define SUBSECTION_SINGLE "Single" #define SUBSECTION_WORDLIST "Wordlist" #define SECTION_INC "Incremental:" #define SECTION_EXT "List.External:" +#define SECTION_MARKOV "Markov:" /* * Number of different password hash table sizes. -- 1.7.7.6