Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Fri, 25 May 2012 15:55:39 +0200
From: Frank Dittrich <>
Subject: Re: Fwd: bash auto-completion for john

On 05/24/2012 10:16 PM, magnum wrote:
> Thanks, committed now.

Thanks. To keep you busy, I changed the script once more.
Those --options= with useful completion values can now be specified in
an abbreviated form, as long as you use = (and not :) as a sepatator
between option name and value.

So, instead of

$ ./john -ru[tab]=s[tab]
to get
$ ./john --rules=single

You can now use
$ ./john -ru=s[tab]
to get
$ ./john -ru=single

This means, type any option (either with just one leading - or with
leading --) in an abbreviated form (which is unambiguous), followed by
=, optionally followed by more characters, to get a list of all possible

$ ./john -i=[tab][tab]
all      alnum    alpha    digits   digits8  lanman

$ ./john -inc=a[tab]
completes to
$ ./john -inc=al

$ ./john -inc=al[tab][tab]
lists these possible completions:
all    alnum  alpha

Currently, this is hard coded, as you can see from the diff.
This means, if john gets a new option named --i<something>, I have to
adjust the script to require --in= or -in= to complete incremental mode
And if I do that, the script will require -in= even for older john
versions where -i= would be unambiguous.
So, a generic implementation instead of a hard coded one would be

Another change I made:
If I provide completions for --external=, --incremental=, --rules= or
--session= using the --list option instead of a hard coded list, I
convert the user input to lower case before completion.

$ ./john -i=D[tab]
results in
$ ./john -i=digits

The idea is to help users who used completion for an older john version
and remember that the section names start with an upper case letter.
Otherwise something that worked for older john versions will stop
working once they switch to a newer one.

$ ./john -i=X[tab][tab]
doesn't change anything, because there is no possible completion
starting with x or X.

For an older john version (without --list),

$ john -i=D[tab]
$ john -i=Digits

To translate to lower case, I used tr.But I think it can be assumed tr
exists on every system with bash.
(I preferred tr over requiring a certain new bash version.)


View attachment "john.bash_completion.diff" of type "text/x-patch" (8171 bytes)

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.