diff -uprN john-1.7.3.1.old/src/options.c john-1.7.3.1/src/options.c --- john-1.7.3.1.old/src/options.c 2008-07-18 03:21:10.000000000 +0200 +++ john-1.7.3.1/src/options.c 2008-10-18 13:25:21.000000000 +0200 @@ -22,11 +22,13 @@ struct options_main options; static struct opt_entry opt_list[] = { {"", FLG_PASSWD, 0, 0, 0, OPT_FMT_ADD_LIST, &options.passwd}, - {"single", FLG_SINGLE_SET, FLG_CRACKING_CHK}, + {"single", FLG_SINGLE_SET, FLG_CRACKING_CHK, 0, 0, + OPT_FMT_STR_ALLOC, &options.rules}, {"wordlist", FLG_WORDLIST_SET, FLG_CRACKING_CHK, 0, OPT_REQ_PARAM, OPT_FMT_STR_ALLOC, &options.wordlist}, {"stdin", FLG_STDIN_SET, FLG_CRACKING_CHK}, - {"rules", FLG_RULES, FLG_RULES, FLG_WORDLIST_CHK, FLG_STDIN_CHK}, + {"rules", FLG_RULES, FLG_RULES, FLG_WORDLIST_CHK, FLG_STDIN_CHK, + OPT_FMT_STR_ALLOC, &options.rules}, {"incremental", FLG_INC_SET, FLG_CRACKING_CHK, 0, 0, OPT_FMT_STR_ALLOC, &options.charset}, {"external", FLG_EXTERNAL_SET, FLG_EXTERNAL_CHK, @@ -83,9 +85,9 @@ static struct opt_entry opt_list[] = { "Homepage: http://www.openwall.com/john/\n" \ "\n" \ "Usage: %s [OPTIONS] [PASSWORD-FILES]\n" \ -"--single \"single crack\" mode\n" \ +"--single[=MODE] \"single crack\" mode\n" \ "--wordlist=FILE --stdin wordlist mode, read words from FILE or stdin\n" \ -"--rules enable word mangling rules for wordlist mode\n" \ +"--rules[=MODE] enable word mangling rules for wordlist mode\n" \ "--incremental[=MODE] \"incremental\" mode [using section MODE]\n" \ "--external=MODE external mode or word filter\n" \ "--stdout[=LENGTH] just output candidate passwords [cut at LENGTH]\n" \ diff -uprN john-1.7.3.1.old/src/options.h john-1.7.3.1/src/options.h --- john-1.7.3.1.old/src/options.h 2006-01-09 15:34:50.000000000 +0100 +++ john-1.7.3.1/src/options.h 2008-10-18 12:54:57.000000000 +0200 @@ -113,6 +113,9 @@ struct options_main { /* Maximum plaintext length for stdout mode */ int length; + +/* Rules section */ + char *rules; }; extern struct options_main options; diff -uprN john-1.7.3.1.old/src/single.c john-1.7.3.1/src/single.c --- john-1.7.3.1.old/src/single.c 2006-02-27 05:23:18.000000000 +0100 +++ john-1.7.3.1/src/single.c 2008-10-18 13:26:16.000000000 +0200 @@ -12,6 +12,7 @@ #include "signals.h" #include "loader.h" #include "logger.h" +#include "options.h" #include "status.h" #include "recovery.h" #include "rpp.h" @@ -87,7 +88,8 @@ static void single_init(void) key_count = single_db->format->params.min_keys_per_crypt; if (key_count < SINGLE_HASH_MIN) key_count = SINGLE_HASH_MIN; - if (rpp_init(rule_ctx, SUBSECTION_SINGLE)) { + if (rpp_init(rule_ctx, + options.rules ? options.rules : SUBSECTION_SINGLE)) { log_event("! No \"single crack\" mode rules found"); fprintf(stderr, "No \"single crack\" mode rules found in %s\n", cfg_name); diff -uprN john-1.7.3.1.old/src/wordlist.c john-1.7.3.1/src/wordlist.c --- john-1.7.3.1.old/src/wordlist.c 2006-02-27 05:20:33.000000000 +0100 +++ john-1.7.3.1/src/wordlist.c 2008-10-18 13:07:27.000000000 +0200 @@ -15,6 +15,7 @@ #include "signals.h" #include "loader.h" #include "logger.h" +#include "options.h" #include "status.h" #include "recovery.h" #include "rpp.h" @@ -148,7 +149,8 @@ void do_wordlist_crack(struct db_main *d length = db->format->params.plaintext_length; if (rules) { - if (rpp_init(rule_ctx = &ctx, SUBSECTION_WORDLIST)) { + if (rpp_init(rule_ctx = &ctx, + options.rules ? options.rules : SUBSECTION_WORDLIST)) { log_event("! No wordlist mode rules found"); fprintf(stderr, "No wordlist mode rules found in %s\n", cfg_name);