Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <BLU0-SMTP12F3772C2AC91917DFE336FD100@phx.gbl>
Date: Wed, 9 May 2012 00:31:19 +0200
From: Frank Dittrich <frank_dittrich@...mail.com>
To: john-dev@...ts.openwall.com
Subject: Re: Fwd: bash auto-completion for john

On 05/08/2012 09:59 PM, magnum wrote:
> On 05/08/2012 08:15 PM, Frank Dittrich wrote:
>> On 05/08/2012 08:58 AM, magnum wrote:
>>> Of course, we should also support dynamic completion of --format. I
>>> suppose this wont need any hidden option, we already get a parsable list
>>> from john with no options.
>>
>> Done. (works for older john versions (force hash type NAME:
>> DES/BSDI/MD5/BF/AFS/LM/crypt...) and newer jumbo versions.
> 
> Wow. This is better than I expected in this short time. Excellent! I'll
> commit this along with a make rule for installing.

Your Makefile changes are rather optimistic, or am I missing something?

$ cp test /etc/bash_completion.d/
cp: cannot create regular file `/etc/bash_completion.d/test': Permission
denied

$ echo $?
1

IMO, you should test for the error condition.

BTW, on my system, for user root cp is an alias:
# alias cp
alias cp='cp -i'

May be you have to rm the file first, or use /bin/cp?
I don't really like any of these options.
And, for root, rm is also an alias:
# alias rm
alias rm='rm -i'

Better don't mess with /etc/bash_completion.d, and just write
instructions how to enable bash completion for john?


> If/when you update it further, just post it here and I'll update git.

OK. Currently implemented:

1.
Improved expansion for --config= (only files *.conf and *.ini will be
suggested; IMO this is what sane people would want to have, even if you
could also name your config file john.log)
Negative side effect: expansion for ~ doesn't work anymore, but that is
probably less important. (I hate doing this "manually", there really
must be another way. The code is already full of ugly hacks, no need to
add even more of them.)

2.
Improved expansion for --pot= (only files *.pot are considered, same
logic as above for --config; tilde expansion no longer works)

3.
Q&D expansion for --restore and --status
(added dependency to ls, list all .rec files in current directory to get
the session names...)
For system wide installations, I would have to check ~/.john/ directory
instead.
But as of now my only idea of distinguishing system wide and individual
installations is using strings <executable> | grep 'john\.conf' ...

4.
Fixed typo (encoding)...
Thanks for noticing.
In my final test before sending the mail I noticed that I would try to
expand --encoding= even for john versions that don't support this
option. I tried to add a fix for this problem, but failed to test this.

That's why I will continue testing my latest changes before sending you
the next update, probably tomorrow.

For proper support of --incremental=, --external=, --rules=, --single=,
I think we need a hidden option in john to get those lists (2 different
lists for --external; one for modes with generate() function, one for
modes without) in an easy to parse way.
Similarly, an easy way to distinguish between system wide and individual
installations, or the default location of conf, pot, and rec files, OMP
support built in or not, ....
If we want to enhance completion support even more, we might want to get
more detailed information about individual hash formats
(salted, not salted, maximum password length, ...)
Some of the information can be obtained from running
john --format=xyz --test=n from within the bash completion script.
But I'm not sure I want to do it.
(I could run --test=100 and redirect all output to /dev/null on
arbitrary user error, say when the user specified a non-existing option
on the command line ;)

Frank

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.