|
Message-ID: <BLU0-SMTP184A1135FCF637D6EDF4708FD110@phx.gbl>
Date: Wed, 9 May 2012 19:13:07 +0200
From: Frank Dittrich <frank_dittrich@...mail.com>
To: john-dev@...ts.openwall.com
Subject: Re: bash auto-completion for john
On 05/09/2012 02:42 AM, Frank Dittrich wrote:
> On 05/09/2012 01:15 AM, magnum wrote:
>> On 05/09/2012 12:31 AM, Frank Dittrich wrote:
>>> 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.)
>>
>> Is your very first approach, with "complete -F _filedir_xspec john" not
>> usable together with auto-completion?
>
> No, because the
> complete -F _filedir_xspec john
> in my .bashrc would overwrite the
> complete -F _john john
> at the end of the bash completion script.
Meanwhile I found a solution for this problem, but I am nor very happy
with it.
I found the __expand_tilde_by_ref function in /etc/bash_completion.
It seems to do exactly what I need.
Nevertheless, i am a bit unhappy, because:
1. I found no usage of this function in any other file in
/etc/bash_completion.d/
2. the name starts with __, so this function might not be part of an
"official" API (if such a thing exists at all).
That's why I used
__expand_tilde_by_ref cur 2>/dev/null
to silence any possible errors in case that function might not exist.
I tested this with temporarily using
__FDTEST__expand_tilde_by_ref cur 2>/dev/null
No negative side effects, except that tilde expansion doesn't work when
the function does not exist.
Other changes:
1. I got rid of the dependency on ls (replaced by for f in *.rec ...),
so that the only external commands needed are sed and grep.
2. I added bash completion for unique.
But I didn't create another file. Instead, I added a function _unique to
the existing script.
For the old (official) unique without any options, there is no
auto-completion (offering existing files doesn't make much sense,
because the output file must not exist).
For the jumbo version, bash completion works like this:
$ cd magnumripper-magnum-jumbo-46dd1ae/run/
$ echo ''|./unique
[-cut=len] [-ex_file_only=FNAME2] [-mem=num] [-v]
[-ex_file=FNAME2] [-inp=fname] OUTPUT-FILE
$ echo ''|./unique -
-cut= -ex_file= -ex_file_only= -inp= -mem=
-v
$ echo ''|./unique -ex_file
-ex_file= -ex_file_only=
$ echo ''|./unique -ex_file_only=
all.chr fdtest ldif2john.pl pdf2john
ssh2john
alnum.chr genincstats.rb lion2john-alt.pl pw
stats
...
File attached.
Frank
View attachment "john" of type "text/plain" (12585 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.