Closed jfoug closed 9 years ago
Here is all it takes (pretty trivial stuff). I like this fatter list of formats better. BUT is there any reason why this change CAN NOT be made??
$ git diff options.c
diff --git a/src/options.c b/src/options.c
index e012507..782afab 100644
--- a/src/options.c
+++ b/src/options.c
@@ -343,10 +343,11 @@ JOHN_USAGE_FORK \
"--list=WHAT list capabilities, see --list=help or doc/OPTIONS\n"
#define JOHN_USAGE_FORMAT \
-"--format=NAME force hash type NAME:"
+"--format=NAME force hash type NAME can be one of the following:\n\n" \
+ JOHN_USAGE_INDENT
#define JOHN_USAGE_INDENT \
-" " // formats are prepended with a space
+" " // formats are prepended with a space
#if defined(HAVE_OPENCL) && defined(HAVE_CUDA)
#define JOHN_USAGE_GPU \
@@ -402,7 +403,7 @@ static void print_usage(char *name)
printf("%s", JOHN_USAGE_GPU);
#endif
printf("%s", JOHN_USAGE_FORMAT);
- column = sizeof(JOHN_USAGE_FORMAT);
+ column = strlen(JOHN_USAGE_INDENT);
i = 0;
do {
@@ -417,6 +418,7 @@ static void print_usage(char *name)
printf(" %s%s", label, formats_list[i] ? "" : "\n");
} while (formats_list[i]);
MEM_FREE(formats_list);
+ printf ("\n");
exit(0);
}
Actually I think we should instead separate the format list from the usage blob. Just skip the formats list and instead print a last line saying you should use --list=formats
to see it. And that list is already without indentation.
Would that break TS though? And/or bash completion?
Ok, do you want me to make this change (NOTE, i have to make a change to the TS, which I have also done).
$ ../run/john
John the Ripper password cracker, version 1.8.0.2-jumbo-1-bleeding [cygwin 64-bit AVX-autoconf]
Copyright (c) 1996-2014 by Solar Designer and others
Homepage: http://www.openwall.com/john/
Usage: john [OPTIONS] [PASSWORD-FILES]
--single[=SECTION] "single crack" mode
--wordlist[=FILE] --stdin wordlist mode, read words from FILE or stdin
--pipe like --stdin, but bulk reads, and allows rules
--loopback[=FILE] like --wordlist, but fetch words from a .pot file
--dupe-suppression suppress all dupes in wordlist (and force preload)
--prince[=FILE] PRINCE mode, read words from FILE
--encoding=NAME input encoding (eg. UTF-8, ISO-8859-1). See also
doc/ENCODING and --list=hidden-options.
--rules[=SECTION] enable word mangling rules for wordlist modes
--incremental[=MODE] "incremental" mode [using section MODE]
--mask=MASK mask mode using MASK
--markov[=OPTIONS] "Markov" mode (see doc/MARKOV)
--external=MODE external mode or word filter
--stdout[=LENGTH] just output candidate passwords [cut at LENGTH]
--restore[=NAME] restore an interrupted session [called NAME]
--session=NAME give a new session the NAME
--status[=NAME] print status of a session [called NAME]
--make-charset=FILE make a charset file. It will be overwritten
--show[=LEFT] show cracked passwords [if =LEFT, then uncracked]
--test[=TIME] run tests and benchmarks for TIME seconds each
--users=[-]LOGIN|UID[,..] [do not] load this (these) user(s) only
--groups=[-]GID[,..] load users [not] of this (these) group(s) only
--shells=[-]SHELL[,..] load users with[out] this (these) shell(s) only
--salts=[-]COUNT[:MAX] load salts with[out] COUNT [to MAX] hashes
--save-memory=LEVEL enable memory saving, at LEVEL 1..3
--node=MIN[-MAX]/TOTAL this node's number range out of TOTAL count
--fork=N fork N processes
--pot=NAME pot file to use
--list=WHAT list capabilities, see --list=help or doc/OPTIONS
--format=NAME force hash of type NAME. The supported hashes can
be seen with --list=formats and --list=subformats
Would that break TS though? And/or bash completion?
TS, yes. But I have fixed it. https://github.com/magnumripper/jtrTestSuite/commit/70cd598a3d857ed829beaec56f93ca28bc3c62ad I just assume that if I do not find a ':' character on the line starting with --format=NAME, then it is this new format, and simply get the data using --list=formats and have slightly modified regex to parse it.
As for bash completion, I bet this will break it also, but the change there likely will be trivial also (unless Frank already is using the --list=formats)
@frank-dittrich can you comment. I really do not want to check this in, when there are known parts of the toolset that will fail.
Currently, john.bash_completion tries to process john's usage output to get the format list (line 335) and adds the format classes mentioned in ./john --list=hidden-options
--format=CLASS output. (line 338)
It ould have to be changed to use --list=formats (or --list=format-details instad of usage output, and process the usage output only as a fallback (for core) if --list=formats doesn't succeed.
@frank-dittrich Please review 245aeb2 I am pretty sure this fixed the problem. NOTE, I have not checked in the new version yet, but with this change I will do so. I do not have bash completion set on my normal runtime (simply WAY too slow and gets in the way), so I really do not test this much.
9e3bb75 is the update to john usage screen, removing the format strings.
Looks good to me, though I think I would prefer "The supported formats can be seen..." over "The supported hashes can be seen...".
I do not have bash completion set on my normal runtime (simply WAY too slow and gets in the way)
How come it's slow? The bash completion is the best improvement of all in Jumbo over the last 10 years. I would go mad without it.
When I use it, hit tab, etc, it hangs, from 2 to 5s. I simply can type in 10x faster, and know what I want to say 90% of the time. Yes, when doing some obscure stuff I do not normally do, it would be faster, but I just feel it gets in my way.
That's in Cygwin only, right? We should find out the cause. You really can't notice any delay on OSX or Linux.
cygwin, yes. Cygwin spawning is very slow. Compile is about 4x slower than on my ubuntu VM. ./configure is about 10x slower. I think that part of the problem is I have all sorts of old network mounts (we are talking OLD, some even running Novell, possibly DOS systems). There are also probably 10k files on my search path. I really need to clean that up from my cygwin path. Unfortunately things like c:\windows\system32 need to be in search path, and they are a graveyard of crap, 1000's of files, most not directly executable, but there are a few really important ones.
Ok, here is the current verbiage:
--format=NAME force hash of type NAME. The supported hashes can
be seen with --list=formats and --list=subformats
What EXACTLY do you want that to be?
I thought this would look better but you can talk me out of it
--format=NAME force hash of type NAME. The supported formats can
be seen with --list=formats and --list=subformats
That works, I can easlily change it. The only thing I want to make sure is that '--list=formats' shows up on the bash-completion. I key off that search string. If it shows up in the format list, then I assume this version of john does not show the format list on the normal usage, and re-run to get a --list=formats string.
Here is the current output
How about this type change?