Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <BLU0-SMTP1123021363446FF0B6C5A36FD110@phx.gbl>
Date: Wed, 9 May 2012 15:39:55 +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:35 AM, Aleksey Cherepanov wrote:
> On Tue, May 08, 2012 at 08:58:48AM +0200, 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.
> 
> Yes, it is parsable. I used
> john | perl -nle '$f = 0 if /^--/; $f = 1 if /^--format/; print $1 while m!([-\w\(\)]+)(/|$)!g && $f'
> to get list from John's output for Johnny. It watches for --format key, then
> it prints all words (with dashes and digits, and even braces) followed by
> slash or end of line until it reaches any other key.

For magnumripper-magnum-jumbo-46dd1ae, this command

$ ./john | perl -nle '$f = 0 if /^--/; $f = 1 if /^--format/; print $1
while m!([-\w\(\)]+)(/|$)!g && $f'

prints

crypt
dominosec
dragonfly4-32
episerver
hmac-sha256
krb4
mscash
mysql-fast
netntlmv2
pdf
raw-md4
raw-sha224
sapg
zip

As we all know, perl is a write-only language, that's why I'll not look
for the error.
But there are many more formats:

--format=NAME             force hash type NAME: afs bf bfegg bsdi crc32
crypt
                          cryptsha256 cryptsha512 des dmd5 dominosec
                          dragonfly3-32 dragonfly3-64 dragonfly4-32
                          dragonfly4-64 drupal7 dummy dynamic_n epi
episerver
                          hdaa hmac-md5 hmac-sha1 hmac-sha224 hmac-sha256
                          hmac-sha384 hmac-sha512 hmailserver ipb2
keychain krb4
                          krb5 lm lotus5 md4-gen md5 md5ns mediawiki mscash
                          mscash2 mschapv2 mskrb5 mssql mssql05 mysql
mysql-fast
                          mysql-sha1 nethalflm netlm netlmv2 netntlm
netntlmv2
                          nsldap nt nt2 office oracle oracle11 osc pdf
                          phpass-md5 phps pix-md5 pkzip po racf rar raw-md4
                          raw-md5 raw-md5u raw-sha raw-sha1 raw-sha224
                          raw-sha256 raw-sha384 raw-sha512 salted-sha1
sapb sapg
                          sha1-gen sip ssh sybasease trip vnc xsha
xsha512 zip


My bash-completion for ./john --format= gives:
afs            dragonfly4-32  hmac-sha512    mscash2        nsldap
   racf           sapg
bf             dragonfly4-64  hmailserver    mschapv2       nt
   rar            sha1-gen
bfegg          drupal7        ipb2           mskrb5         nt2
   raw-md4        sip
bsdi           dummy          keychain       mssql          office
   raw-md5        ssh
crc32          dynamic        krb4           mssql05        oracle
   raw-md5u       sybasease
crypt          epi            krb5           mysql          oracle11
   raw-sha        trip
cryptsha256    episerver      lm             mysql-fast     osc
   raw-sha1       vnc
cryptsha512    hdaa           lotus5         mysql-sha1     pdf
   raw-sha224     xsha
des            hmac-md5       md4-gen        nethalflm      phpass-md5
   raw-sha256     xsha512
dmd5           hmac-sha1      md5            netlm          phps
   raw-sha384     zip
dominosec      hmac-sha224    md5ns          netlmv2        pix-md5
   raw-sha512
dragonfly3-32  hmac-sha256    mediawiki      netntlm        pkzip
   salted-sha1
dragonfly3-64  hmac-sha384    mscash         netntlmv2      po
   sapb

I replaced dynamic_n with dynamic, because I think --format=dynamic is
valid, but --format=dynamic_n isn't.

Instead, all the subformats listed with --subformat=LIST are valid:

That's why, auto-completion of --format=dy gives --format=dynamic.
Auto-completion of --format=dynamic gives --format=dynamic_.
Auto-completion of --format=dynamic_ lists these options:
dynamic_0     dynamic_1005  dynamic_13    dynamic_2     dynamic_26
dynamic_32    dynamic_8
dynamic_1     dynamic_1006  dynamic_14    dynamic_20    dynamic_27
dynamic_33    dynamic_9
dynamic_10    dynamic_1007  dynamic_15    dynamic_21    dynamic_28
dynamic_34
dynamic_1001  dynamic_1008  dynamic_16    dynamic_22    dynamic_29
dynamic_4
dynamic_1002  dynamic_1009  dynamic_17    dynamic_23    dynamic_3
dynamic_5
dynamic_1003  dynamic_11    dynamic_18    dynamic_24    dynamic_30
dynamic_6
dynamic_1004  dynamic_12    dynamic_19    dynamic_25    dynamic_31
dynamic_7

In my bash completion script, I use something like

./john|grep -A 100 '^--format='|sed 's#^--format=[ A-Za-z]*:##'|grep -v
'^--'|sed 's#^ *##'|sed 's#[/ ]#\n#g'|sed 's#^dynamic_n$#dynamic#'

If john supports the --subformat=LIST option, I get the subformats with

./john --subformat=LIST|sed 's#^User##'|
sed 's#^Format = \(dynamic_[0-9]*\).*$#\1#'


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.