>From 04160f6af5734bd496d30ed271582ca2da1f2b58 Mon Sep 17 00:00:00 2001 From: Frank Dittrich Date: Wed, 4 Jul 2012 08:55:21 +0200 Subject: [PATCH 1/4] =?UTF-8?q?New=20--list=3Dhelp=20instead=20of=20--list=3D?= =?UTF-8?q?=3F?= --- doc/OPTIONS | 2 +- src/john.c | 29 +++++++++++++++++++++-------- src/options.c | 2 +- 3 files changed, 23 insertions(+), 10 deletions(-) diff --git a/doc/OPTIONS b/doc/OPTIONS index b3ab602..0ea34f5 100644 --- a/doc/OPTIONS +++ b/doc/OPTIONS @@ -282,7 +282,7 @@ the log file. --list=WHAT list capabilities This option can be used to gain information about what rules, modes etc are -available. Use --list=? for a list of valid arguments. For example, the now +available. Use --list=help for a list of valid arguments. For example, the now deprecated --subformat=LIST is now --list=subformats. The different variants of list externals may be worth mentioning: diff --git a/src/john.c b/src/john.c index b956ff0..16bf7c3 100644 --- a/src/john.c +++ b/src/john.c @@ -514,14 +514,13 @@ static void CPU_detect_or_fallback(char **argv, int make_check) static void john_list_options() { /* - * Should this list be sorted alphabetically? - * Sould we add --list=help, providing a more detailed list than --list=? - * (including a description similar to information currently only available - * in doc/OPTIONS)? + * Put "help" up front. For now, add the optional [:format-methods] hard coded. + * Think about a general solution if more such option appear. + * May be just change it to "help[:WHAT]" instead. */ - puts("subformats, inc-modes, rules, externals, ext-filters, ext-filters-only,"); - puts("ext-modes, build-info, hidden-options, encodings, formats, format-details,"); - printf("format-all-details, format-methods[:WHICH], "); + puts("help[:format-methods], subformats, inc-modes, rules, externals, ext-filters,"); + puts("ext-filters-only, ext-modes, build-info, hidden-options, encodings, formats,"); + puts("format-details, format-all-details, format-methods[:WHICH],"); #ifdef CL_VERSION_1_0 printf("opencl-devices, "); #endif @@ -547,11 +546,25 @@ static void john_init(char *name, int argc, char **argv) john_register_all(); /* for printing by opt_init() */ opt_init(name, argc, argv); - if (options.listconf && !strcasecmp(options.listconf, "?")) + /* + * --list=? needs to be supported, because it has been supported in the released + * john-1.7.9-jumbo-6 version, and it is used by the bash completion script. + * --list=? is, however, not longer mentioned in doc/OPTIONS and in the usage + * output. Instead, --list=help is. + */ + if (options.listconf && + (!strcasecmp(options.listconf, "help") || + (!strcmp(options.listconf, "?")))) { john_list_options(); exit(0); } + if (options.listconf && !strcasecmp(options.listconf, "help:format-methods")) + { + puts("init, prepare, valid, split, binary, salt, binary_hash, salt_hash, set_salt,"); + puts("set_key, get_key, clear_keys, crypt_all, get_hash, cmp_all, cmp_one, cmp_exact"); + exit(0); + } if (options.listconf && !strcasecmp(options.listconf, "hidden-options")) { puts("--subformat=FORMAT pick a benchmark format for --format=crypt"); diff --git a/src/options.c b/src/options.c index e82550d..13a81d9 100644 --- a/src/options.c +++ b/src/options.c @@ -198,7 +198,7 @@ static struct opt_entry opt_list[] = { " " // formats are prepended with a space #define JOHN_USAGE_TAIL \ -"--list=WHAT list capabilities, see --list=? or doc/OPTIONS\n" \ +"--list=WHAT list capabilities, see --list=help or doc/OPTIONS\n" \ "--save-memory=LEVEL enable memory saving, at LEVEL 1..3\n" \ "--mem-file-size=SIZE size threshold for wordlist preload (default 5 MB)\n" \ "--nolog disables creation and writing to john.log file\n" \ -- 1.7.7.6