[GH-ISSUE #1716] Add bash completion for dynamic compiler formats #1131

Open
opened 2026-10-14 03:36:06 +07:00 by bsakaguchi · 26 comments
Owner

Originally created by @magnumripper on GitHub (Aug 28, 2015).
Original GitHub issue: https://github.com/openwall/john/issues/1716

Originally assigned to: @frank-dittrich on GitHub.

This is half a joke and half serious. If we brainstorm a little, maybe we find out it's actually possible.

It would be very cool to

$ ../run/john -test -form:dynamic='<TAB><TAB>

and get

$ ../run/john -test -form:dynamic='
gost  haval128_3  haval128_4  haval128_5  haval160_3  haval160_4  haval160_5  
haval192_3  haval192_4  haval192_5  haval224_3  haval224_4  haval224_5  
haval256_3  haval256_4  haval256_5  keccak_256  keccak_512  md2  md4  md5  
panama  peoplesoft,  ripemd128  ripemd160  ripemd256  ripemd320  sha1  sha224  
sha256  sha384  sha3_224  sha3_256  sha3_384  sha3_512  sha512  skein224  
skein256  skein384  skein512  tiger  whirlpool
$ ../run/john -test -form:dynamic='_

and so on

$ ../run/john -test -form:dynamic='sha<TAB><TAB>
sha1  sha224  sha256  sha384  sha3_224  sha3_256  sha3_384  sha3_512  sha512
$ ../run/john -test -form:dynamic='sha_

As always with bash completion, it's not so much about saving a keypress. It's about listing the alternatives in a super convenient way.

I'm a bit worried the (mandatory) single-quote makes it harder though. Not that I have any other source for my worries than gut feeling.

Originally created by @magnumripper on GitHub (Aug 28, 2015). Original GitHub issue: https://github.com/openwall/john/issues/1716 Originally assigned to: @frank-dittrich on GitHub. This is half a joke and half serious. If we brainstorm a little, maybe we find out it's actually possible. It would be very cool to ``` $ ../run/john -test -form:dynamic='<TAB><TAB> ``` and get ``` $ ../run/john -test -form:dynamic=' gost haval128_3 haval128_4 haval128_5 haval160_3 haval160_4 haval160_5 haval192_3 haval192_4 haval192_5 haval224_3 haval224_4 haval224_5 haval256_3 haval256_4 haval256_5 keccak_256 keccak_512 md2 md4 md5 panama peoplesoft, ripemd128 ripemd160 ripemd256 ripemd320 sha1 sha224 sha256 sha384 sha3_224 sha3_256 sha3_384 sha3_512 sha512 skein224 skein256 skein384 skein512 tiger whirlpool $ ../run/john -test -form:dynamic='_ ``` and so on ``` $ ../run/john -test -form:dynamic='sha<TAB><TAB> sha1 sha224 sha256 sha384 sha3_224 sha3_256 sha3_384 sha3_512 sha512 $ ../run/john -test -form:dynamic='sha_ ``` As always with bash completion, it's not so much about saving a keypress. It's about listing the alternatives in a super convenient way. I'm a bit worried the (mandatory) single-quote makes it harder though. Not that I have any other source for my worries than gut feeling.
Author
Owner

@frank-dittrich commented on GitHub (Aug 28, 2015):

If I get a

--list=<whatever_we_call_the_crypto_primitives_supported_by_the_dynamic_compiler>

It should be easy. I should list 'md5( 'sha1( ... because that's what you really would insert.
Not so easy will be the part where you are in the middle of an expression ($p, $s, tons of other stuff).
Another --list=?
And, depending on how many opening parentheses you have, I can also add ) )) ))) to the list of possible completions.

Next time you'll ask for completion in --mask mode for completing ?.

<!-- gh-comment-id:135655960 --> @frank-dittrich commented on GitHub (Aug 28, 2015): If I get a ``` --list=<whatever_we_call_the_crypto_primitives_supported_by_the_dynamic_compiler> ``` It should be easy. I should list `'md5( 'sha1( ...` because that's what you really would insert. Not so easy will be the part where you are in the middle of an expression (`$p`, `$s`, tons of other stuff). Another --list=<name>? And, depending on how many opening parentheses you have, I can also add `) )) )))` to the list of possible completions. Next time you'll ask for completion in --mask mode for completing `?`.
Author
Owner

@magnumripper commented on GitHub (Aug 30, 2015):

We can list them like this:

$ ../run/john -list=subformats | awk '{print $7}' | grep -v cisco | cut -d\( -f1 | sort -u | xargs echo | fold -s 
gost haval128_3 haval128_4 haval128_5 haval160_3 haval160_4 haval160_5 
haval192_3 haval192_4 haval192_5 haval224_3 haval224_4 haval224_5 haval256_3 
haval256_4 haval256_5 keccak_256 keccak_512 md2 md4 md5 panama ripemd128 
ripemd160 ripemd256 ripemd320 sha1 sha1_64 sha224 sha256 sha384 sha3_224 
sha3_256 sha3_384 sha3_512 sha512 skein224 skein256 skein384 skein512 tiger 
whirlpool

For bash-completion I guess you can omit everything after the sort. Note that I'm filtering out cisco because it's a false result when doing this.

<!-- gh-comment-id:136178324 --> @magnumripper commented on GitHub (Aug 30, 2015): We can list them like this: ``` $ ../run/john -list=subformats | awk '{print $7}' | grep -v cisco | cut -d\( -f1 | sort -u | xargs echo | fold -s gost haval128_3 haval128_4 haval128_5 haval160_3 haval160_4 haval160_5 haval192_3 haval192_4 haval192_5 haval224_3 haval224_4 haval224_5 haval256_3 haval256_4 haval256_5 keccak_256 keccak_512 md2 md4 md5 panama ripemd128 ripemd160 ripemd256 ripemd320 sha1 sha1_64 sha224 sha256 sha384 sha3_224 sha3_256 sha3_384 sha3_512 sha512 skein224 skein256 skein384 skein512 tiger whirlpool ``` For bash-completion I guess you can omit everything after the sort. Note that I'm filtering out cisco because it's a false result when doing this.
Author
Owner

@jfoug commented on GitHub (Aug 30, 2015):

Not fully valid:

cisco, peoplesoft show up as subformats.

<!-- gh-comment-id:136178773 --> @jfoug commented on GitHub (Aug 30, 2015): Not fully valid: cisco, peoplesoft show up as subformats.
Author
Owner

@magnumripper commented on GitHub (Aug 30, 2015):

I beat you to it ;-) Command was edited and a commit changed the PeopleSoft thingy.

<!-- gh-comment-id:136178844 --> @magnumripper commented on GitHub (Aug 30, 2015): I beat you to it ;-) Command was edited and a commit changed the PeopleSoft thingy.
Author
Owner

@jfoug commented on GitHub (Aug 30, 2015):

Ok, pplsoft is gone, but cisco still shows.

<!-- gh-comment-id:136178849 --> @jfoug commented on GitHub (Aug 30, 2015): Ok, pplsoft is gone, but cisco still shows.
Author
Owner

@magnumripper commented on GitHub (Aug 30, 2015):

@jfoug ideally PIX should list (in subformats) as "md5($p) (Cisco PIX)" or something like that, and similar for ASA. Much like I did to PeopleSoft. Are they truncated? What would a compiler formula look like?

<!-- gh-comment-id:136179310 --> @magnumripper commented on GitHub (Aug 30, 2015): @jfoug ideally PIX should list (in subformats) as "md5($p) (Cisco PIX)" or something like that, and similar for ASA. Much like I did to PeopleSoft. Are they truncated? What would a compiler formula look like?
Author
Owner

@magnumripper commented on GitHub (Aug 30, 2015):

@jfoug I'm changing dynamic_preloads.c to this for now:

Format = dynamic_19  type = dynamic_19: md5($p) (cisco pix)
Format = dynamic_20  type = dynamic_20: md5($p.$s) (cisco asa)
<!-- gh-comment-id:136179983 --> @magnumripper commented on GitHub (Aug 30, 2015): @jfoug I'm changing dynamic_preloads.c to this for now: ``` Format = dynamic_19 type = dynamic_19: md5($p) (cisco pix) Format = dynamic_20 type = dynamic_20: md5($p.$s) (cisco asa) ```
Author
Owner

@magnumripper commented on GitHub (Aug 30, 2015):

The grep -v cisco is no longer needed after 8564945

<!-- gh-comment-id:136180051 --> @magnumripper commented on GitHub (Aug 30, 2015): The `grep -v cisco` is no longer needed after 8564945
Author
Owner

@jfoug commented on GitHub (Aug 30, 2015):

will this need adjustments in relbench?

<!-- gh-comment-id:136190923 --> @jfoug commented on GitHub (Aug 30, 2015): will this need adjustments in relbench?
Author
Owner

@frank-dittrich commented on GitHub (Aug 30, 2015):

No, it won't. And benchmark-unify neither.

relbench is ignoring anything within [ and ].

<!-- gh-comment-id:136196436 --> @frank-dittrich commented on GitHub (Aug 30, 2015): No, it won't. And benchmark-unify neither. relbench is ignoring anything within `[` and `]`.
Author
Owner

@frank-dittrich commented on GitHub (Jan 15, 2016):

I now have a patch which does the following:

(bleeding-jumbo)run $ ./john --format=dy[tab] 

completes to

(bleeding-jumbo)run $ ./john --format=dynamic

as before this patch (provided dynamic is a valid format).

(bleeding-jumbo)run $ ./john --format=dynamic[tab][tab] 
dynamic=  dynamic_

Prior to this patch,

(bleeding-jumbo)run $ ./john --format=dynamic[tab]

would get completed to

(bleeding-jumbo)run $ ./john --format=dynamic_

So, for john versions which have dynamic, but don't support dynamic=, this is a regression.

(bleeding-jumbo)run $ ./john --format=dynamic=[tab][tab]
gost(        haval224_4(  ripemd128(   sha3_384(
haval128_3(  haval224_5(  ripemd160(   sha3_512(
haval128_4(  haval256_3(  ripemd256(   sha512(
haval128_5(  haval256_4(  ripemd320(   skein224(
haval160_3(  haval256_5(  sha1(        skein256(
haval160_4(  keccak_256(  sha1_64(     skein384(
haval160_5(  keccak_512(  sha224(      skein512(
haval192_3(  md2(         sha256(      tiger(
haval192_4(  md4(         sha384(      whirlpool(
haval192_5(  md5(         sha3_224(    
haval224_3(  panama(      sha3_256(    
(bleeding-jumbo)run $ ./john --format=dynamic=w[tab]

completes to

(bleeding-jumbo)run $ ./john --format=dynamic=whirlpool(
(bleeding-jumbo)run $ ./john --format=dynamic=h[tab]

completes to

(bleeding-jumbo)run $ ./john --format=dynamic=haval
(bleeding-jumbo)run $ ./john --format=dynamic=haval[tab][tab]
haval128_3(  haval160_4(  haval192_5(  haval256_3(
haval128_4(  haval160_5(  haval224_3(  haval256_4(
haval128_5(  haval192_3(  haval224_4(  haval256_5(
haval160_3(  haval192_4(  haval224_5(

And finally, as with older bash completion

(bleeding-jumbo)run $ ./john --format=dynamic_
Display all 434 possibilities? (y or n)
dynamic_0     dynamic_160   dynamic_258   dynamic_368
dynamic_1     dynamic_161   dynamic_26    dynamic_37
dynamic_10    dynamic_162   dynamic_260   dynamic_370
dynamic_100   dynamic_163   dynamic_261   dynamic_371
dynamic_1001  dynamic_164   dynamic_262   dynamic_372
dynamic_1002  dynamic_165   dynamic_263   dynamic_373
dynamic_1003  dynamic_166   dynamic_264   dynamic_374
dynamic_1004  dynamic_167   dynamic_265   dynamic_375
dynamic_1005  dynamic_168   dynamic_266   dynamic_376
dynamic_1006  dynamic_170   dynamic_267   dynamic_377
dynamic_1007  dynamic_171   dynamic_268   dynamic_378
dynamic_1008  dynamic_172   dynamic_270   dynamic_38
dynamic_1009  dynamic_173   dynamic_271   dynamic_380
dynamic_101   dynamic_174   dynamic_272   dynamic_381
dynamic_1010  dynamic_175   dynamic_273   dynamic_382
dynamic_1011  dynamic_176   dynamic_274   dynamic_383
dynamic_1012  dynamic_177   dynamic_275   dynamic_384
dynamic_1013  dynamic_178   dynamic_276   dynamic_385
dynamic_1014  dynamic_18    dynamic_277   dynamic_386
dynamic_1015  dynamic_180   dynamic_278   dynamic_387
dynamic_1016  dynamic_181   dynamic_280   dynamic_388
dynamic_1017  dynamic_182   dynamic_281   dynamic_39
dynamic_1018  dynamic_183   dynamic_282   dynamic_390
dynamic_1019  dynamic_184   dynamic_283   dynamic_391
dynamic_102   dynamic_185   dynamic_284   dynamic_392
dynamic_1020  dynamic_186   dynamic_285   dynamic_393
dynamic_1021  dynamic_187   dynamic_286   dynamic_394
dynamic_1022  dynamic_188   dynamic_287   dynamic_395
dynamic_1023  dynamic_19    dynamic_288   dynamic_396
dynamic_1024  dynamic_190   dynamic_29    dynamic_397
dynamic_1025  dynamic_191   dynamic_290   dynamic_398
dynamic_1026  dynamic_192   dynamic_291   dynamic_4
dynamic_1027  dynamic_193   dynamic_292   dynamic_40
dynamic_1028  dynamic_194   dynamic_293   dynamic_400
dynamic_1029  dynamic_195   dynamic_294   dynamic_401
--More--

Is that good enough?

<!-- gh-comment-id:172122212 --> @frank-dittrich commented on GitHub (Jan 15, 2016): I now have a patch which does the following: ``` (bleeding-jumbo)run $ ./john --format=dy[tab] ``` completes to ``` (bleeding-jumbo)run $ ./john --format=dynamic ``` as before this patch (provided dynamic is a valid format). ``` (bleeding-jumbo)run $ ./john --format=dynamic[tab][tab] dynamic= dynamic_ ``` Prior to this patch, ``` (bleeding-jumbo)run $ ./john --format=dynamic[tab] ``` would get completed to ``` (bleeding-jumbo)run $ ./john --format=dynamic_ ``` So, for john versions which have dynamic, but don't support dynamic=, this is a regression. ``` (bleeding-jumbo)run $ ./john --format=dynamic=[tab][tab] gost( haval224_4( ripemd128( sha3_384( haval128_3( haval224_5( ripemd160( sha3_512( haval128_4( haval256_3( ripemd256( sha512( haval128_5( haval256_4( ripemd320( skein224( haval160_3( haval256_5( sha1( skein256( haval160_4( keccak_256( sha1_64( skein384( haval160_5( keccak_512( sha224( skein512( haval192_3( md2( sha256( tiger( haval192_4( md4( sha384( whirlpool( haval192_5( md5( sha3_224( haval224_3( panama( sha3_256( ``` ``` (bleeding-jumbo)run $ ./john --format=dynamic=w[tab] ``` completes to ``` (bleeding-jumbo)run $ ./john --format=dynamic=whirlpool( ``` ``` (bleeding-jumbo)run $ ./john --format=dynamic=h[tab] ``` completes to ``` (bleeding-jumbo)run $ ./john --format=dynamic=haval ``` ``` (bleeding-jumbo)run $ ./john --format=dynamic=haval[tab][tab] haval128_3( haval160_4( haval192_5( haval256_3( haval128_4( haval160_5( haval224_3( haval256_4( haval128_5( haval192_3( haval224_4( haval256_5( haval160_3( haval192_4( haval224_5( ``` And finally, as with older bash completion ``` (bleeding-jumbo)run $ ./john --format=dynamic_ Display all 434 possibilities? (y or n) dynamic_0 dynamic_160 dynamic_258 dynamic_368 dynamic_1 dynamic_161 dynamic_26 dynamic_37 dynamic_10 dynamic_162 dynamic_260 dynamic_370 dynamic_100 dynamic_163 dynamic_261 dynamic_371 dynamic_1001 dynamic_164 dynamic_262 dynamic_372 dynamic_1002 dynamic_165 dynamic_263 dynamic_373 dynamic_1003 dynamic_166 dynamic_264 dynamic_374 dynamic_1004 dynamic_167 dynamic_265 dynamic_375 dynamic_1005 dynamic_168 dynamic_266 dynamic_376 dynamic_1006 dynamic_170 dynamic_267 dynamic_377 dynamic_1007 dynamic_171 dynamic_268 dynamic_378 dynamic_1008 dynamic_172 dynamic_270 dynamic_38 dynamic_1009 dynamic_173 dynamic_271 dynamic_380 dynamic_101 dynamic_174 dynamic_272 dynamic_381 dynamic_1010 dynamic_175 dynamic_273 dynamic_382 dynamic_1011 dynamic_176 dynamic_274 dynamic_383 dynamic_1012 dynamic_177 dynamic_275 dynamic_384 dynamic_1013 dynamic_178 dynamic_276 dynamic_385 dynamic_1014 dynamic_18 dynamic_277 dynamic_386 dynamic_1015 dynamic_180 dynamic_278 dynamic_387 dynamic_1016 dynamic_181 dynamic_280 dynamic_388 dynamic_1017 dynamic_182 dynamic_281 dynamic_39 dynamic_1018 dynamic_183 dynamic_282 dynamic_390 dynamic_1019 dynamic_184 dynamic_283 dynamic_391 dynamic_102 dynamic_185 dynamic_284 dynamic_392 dynamic_1020 dynamic_186 dynamic_285 dynamic_393 dynamic_1021 dynamic_187 dynamic_286 dynamic_394 dynamic_1022 dynamic_188 dynamic_287 dynamic_395 dynamic_1023 dynamic_19 dynamic_288 dynamic_396 dynamic_1024 dynamic_190 dynamic_29 dynamic_397 dynamic_1025 dynamic_191 dynamic_290 dynamic_398 dynamic_1026 dynamic_192 dynamic_291 dynamic_4 dynamic_1027 dynamic_193 dynamic_292 dynamic_40 dynamic_1028 dynamic_194 dynamic_293 dynamic_400 dynamic_1029 dynamic_195 dynamic_294 dynamic_401 --More-- ``` Is that good enough?
Author
Owner

@frank-dittrich commented on GitHub (Jan 15, 2016):

For older john versions which don't have --list=subformats but which have --subformat=LIST, I could suppress 'dynamic=' and complete 'dynamic' to 'dynamic_', but I doubt it is worth the effort.
(Nobody should run such an old jombo version.)

<!-- gh-comment-id:172123016 --> @frank-dittrich commented on GitHub (Jan 15, 2016): For older john versions which don't have `--list=subformats` but which have `--subformat=LIST`, I could suppress 'dynamic=' and complete 'dynamic' to 'dynamic_', but I doubt it is worth the effort. (Nobody should run such an old jombo version.)
Author
Owner

@frank-dittrich commented on GitHub (Jan 15, 2016):

May be it would be better to use

(bleeding-jumbo)run $ ./john --format=dynamic
dynamic='  dynamic_

and

(bleeding-jumbo)run $ ./john --format=dynamic='
'gost(        'haval192_3(  'haval256_4(  'panama(      'sha224(      'sha512(
'haval128_3(  'haval192_4(  'haval256_5(  'ripemd128(   'sha256(      'skein224(
'haval128_4(  'haval192_5(  'keccak_256(  'ripemd160(   'sha384(      'skein256(
'haval128_5(  'haval224_3(  'keccak_512(  'ripemd256(   'sha3_224(    'skein384(
'haval160_3(  'haval224_4(  'md2(         'ripemd320(   'sha3_256(    'skein512(
'haval160_4(  'haval224_5(  'md4(         'sha1(        'sha3_384(    'tiger(
'haval160_5(  'haval256_3(  'md5(         'sha1_64(     'sha3_512(    'whirlpool(
(bleeding-jumbo)run $ ./john --format=dynamic='

This could be a little bit harder.
And may be users prefer to escape $p etc. in a different way...
(Time for another john bash completion environment variable in addition to __john_completion?)

Even if I change the "default" completion to dynamic=', I could still support completing

(bleeding-jumbo)run $ ./john --format=dynamic=h[tab]

to

(bleeding-jumbo)run $ ./john --format=dynamic=haval

and also still support

(bleeding-jumbo)run $ ./john --format=dynamic=haval[tab][tab]
haval128_3(  haval160_4(  haval192_5(  haval256_3(
haval128_4(  haval160_5(  haval224_3(  haval256_4(
haval128_5(  haval192_3(  haval224_4(  haval256_5(
haval160_3(  haval192_4(  haval224_5(

in addition to

(bleeding-jumbo)run $ ./john --format=dynamic='haval[tab][tab]
'haval128_3(  'haval160_4(  'haval192_5(  'haval256_3(
'haval128_4(  'haval160_5(  'haval224_3(  'haval256_4(
'haval128_5(  'haval192_3(  'haval224_4(  'haval256_5(
'haval160_3(  'haval192_4(  'haval224_5(

But I'll definitely not support completing any of these:

(bleeding-jumbo)run $ ./john --format='dynamic=haval
(bleeding-jumbo)run $ ./john --format'=dynamic=haval
(bleeding-jumbo)run $ ./john --format=dynamic'=haval
(bleeding-jumbo)run $ ./john --format=dynamic=ha'val
(bleeding-jumbo)run $ ./john --format=dy'namic=haval
<!-- gh-comment-id:172127426 --> @frank-dittrich commented on GitHub (Jan 15, 2016): May be it would be better to use ``` (bleeding-jumbo)run $ ./john --format=dynamic dynamic=' dynamic_ ``` and ``` (bleeding-jumbo)run $ ./john --format=dynamic=' 'gost( 'haval192_3( 'haval256_4( 'panama( 'sha224( 'sha512( 'haval128_3( 'haval192_4( 'haval256_5( 'ripemd128( 'sha256( 'skein224( 'haval128_4( 'haval192_5( 'keccak_256( 'ripemd160( 'sha384( 'skein256( 'haval128_5( 'haval224_3( 'keccak_512( 'ripemd256( 'sha3_224( 'skein384( 'haval160_3( 'haval224_4( 'md2( 'ripemd320( 'sha3_256( 'skein512( 'haval160_4( 'haval224_5( 'md4( 'sha1( 'sha3_384( 'tiger( 'haval160_5( 'haval256_3( 'md5( 'sha1_64( 'sha3_512( 'whirlpool( (bleeding-jumbo)run $ ./john --format=dynamic=' ``` This could be a little bit harder. And may be users prefer to escape `$p` etc. in a different way... (Time for another john bash completion environment variable in addition to `__john_completion`?) Even if I change the "default" completion to `dynamic='`, I could still support completing ``` (bleeding-jumbo)run $ ./john --format=dynamic=h[tab] ``` to ``` (bleeding-jumbo)run $ ./john --format=dynamic=haval ``` and also still support ``` (bleeding-jumbo)run $ ./john --format=dynamic=haval[tab][tab] haval128_3( haval160_4( haval192_5( haval256_3( haval128_4( haval160_5( haval224_3( haval256_4( haval128_5( haval192_3( haval224_4( haval256_5( haval160_3( haval192_4( haval224_5( ``` in addition to ``` (bleeding-jumbo)run $ ./john --format=dynamic='haval[tab][tab] 'haval128_3( 'haval160_4( 'haval192_5( 'haval256_3( 'haval128_4( 'haval160_5( 'haval224_3( 'haval256_4( 'haval128_5( 'haval192_3( 'haval224_4( 'haval256_5( 'haval160_3( 'haval192_4( 'haval224_5( ``` But I'll definitely not support completing any of these: ``` (bleeding-jumbo)run $ ./john --format='dynamic=haval (bleeding-jumbo)run $ ./john --format'=dynamic=haval (bleeding-jumbo)run $ ./john --format=dynamic'=haval (bleeding-jumbo)run $ ./john --format=dynamic=ha'val (bleeding-jumbo)run $ ./john --format=dy'namic=haval ```
Author
Owner

@magnumripper commented on GitHub (Jan 16, 2016):

What is listed after $ ./john --format=dynamic='sha1([tab][tab]?

<!-- gh-comment-id:172193666 --> @magnumripper commented on GitHub (Jan 16, 2016): What is listed after `$ ./john --format=dynamic='sha1([tab][tab]`?
Author
Owner

@frank-dittrich commented on GitHub (Jan 16, 2016):

(bleeding-jumbo)run $ ./john --format=dynamic=sha1[tab][tab]
sha1(     sha1_64(  
<!-- gh-comment-id:172194399 --> @frank-dittrich commented on GitHub (Jan 16, 2016): ``` (bleeding-jumbo)run $ ./john --format=dynamic=sha1[tab][tab] sha1( sha1_64( ```
Author
Owner

@frank-dittrich commented on GitHub (Jan 16, 2016):

I just found a bug.

(bleeding-jumbo)run $ ./john --test --format=dynamic=sha1_[tab]

does not complete to sha1_64(, even [tab][tab] will not list any completions.
Similarly

(bleeding-jumbo)run $ ./john --test --format=dynamic=md4[tab]

does not append (.

Will look into that.

<!-- gh-comment-id:172195686 --> @frank-dittrich commented on GitHub (Jan 16, 2016): I just found a bug. ``` (bleeding-jumbo)run $ ./john --test --format=dynamic=sha1_[tab] ``` does not complete to `sha1_64(`, even `[tab][tab]` will not list any completions. Similarly ``` (bleeding-jumbo)run $ ./john --test --format=dynamic=md4[tab] ``` does not append `(`. Will look into that.
Author
Owner

@frank-dittrich commented on GitHub (Jan 16, 2016):

Fixed now, but that's not good enough.
I'll have to escape the ( and ) (and the $) like this:

$ ./john --test --format=dynamic=md4\(\$p\)
Benchmarking: dynamic=md4($p) [128/128 AVX 4x4]... DONE
Raw:    1285K c/s real, 1285K c/s virtual
<!-- gh-comment-id:172196197 --> @frank-dittrich commented on GitHub (Jan 16, 2016): Fixed now, but that's not good enough. I'll have to escape the `(` and `)` (and the `$`) like this: ``` $ ./john --test --format=dynamic=md4\(\$p\) Benchmarking: dynamic=md4($p) [128/128 AVX 4x4]... DONE Raw: 1285K c/s real, 1285K c/s virtual ```
Author
Owner

@frank-dittrich commented on GitHub (Jan 16, 2016):

This is tricky.
Now I have

./john --format=dynamic=md4[tab]

completing to

./john --format=dynamic=md4\(

But

(bleeding-jumbo)run $ ./john --format=dynamic=sha1[tab][tab]
sha1\(     sha1_64\(  

And when I try

(bleeding-jumbo)run $ ./john --format=dynamic=sha1\[tab]

bash just removes the final \, and

(bleeding-jumbo)run $ ./john --format=dynamic=sha1\\[tab]

completes to

(bleeding-jumbo)run $ ./john --format=dynamic=sha1\(

OTOH, escaping every special character with `' might allow us to suggest completions for variables like $p, $s, $c1 etc.

I might even suggest completions like ,debug after the final closing ).
(Might be better with some --list=hidden-option support, for variables like $s, 4p, ... as well as for functions like lc(), uc(), ...=

<!-- gh-comment-id:172197495 --> @frank-dittrich commented on GitHub (Jan 16, 2016): This is tricky. Now I have ``` ./john --format=dynamic=md4[tab] ``` completing to ``` ./john --format=dynamic=md4\( ``` But ``` (bleeding-jumbo)run $ ./john --format=dynamic=sha1[tab][tab] sha1\( sha1_64\( ``` And when I try ``` (bleeding-jumbo)run $ ./john --format=dynamic=sha1\[tab] ``` bash just removes the final `\`, and ``` (bleeding-jumbo)run $ ./john --format=dynamic=sha1\\[tab] ``` completes to ``` (bleeding-jumbo)run $ ./john --format=dynamic=sha1\( ``` OTOH, escaping every special character with `\' might allow us to suggest completions for variables like $p, $s, $c1 etc. I might even suggest completions like `,debug` after the final closing `)`. (Might be better with some --list=hidden-option support, for variables like $s, 4p, ... as well as for functions like lc(), uc(), ...=
Author
Owner

@frank-dittrich commented on GitHub (Jan 16, 2016):

Suggesting ,\$c1 as a completion for ./john -test --format=dynamic=md5\(\$p.\$c1) might require some effort.

<!-- gh-comment-id:172197646 --> @frank-dittrich commented on GitHub (Jan 16, 2016): Suggesting `,\$c1` as a completion for `./john -test --format=dynamic=md5\(\$p.\$c1)` might require some effort.
Author
Owner

@magnumripper commented on GitHub (Jan 16, 2016):

Do you list functions like unicode(), lc() and uc() for possible inclusion after a left paren? Not sure we list them anywhere, maybe we should - so completion can learn and adapt. Edit: you mentioned that.

<!-- gh-comment-id:172249774 --> @magnumripper commented on GitHub (Jan 16, 2016): Do you list functions like unicode(), lc() and uc() for possible inclusion after a left paren? Not sure we list them anywhere, maybe we should - so completion can learn and adapt. _Edit: you mentioned that_.
Author
Owner

@frank-dittrich commented on GitHub (Jan 16, 2016):

So far I don't support any completion after the opening parenthesis.
Before we implement a new --list= command for that, I need to figure out how to solve this in general, with unicode\( lc\( uc\( added to the list of possible functions.
If that works, I also need to consider MD5\( instead of md5\( etc.

<!-- gh-comment-id:172257065 --> @frank-dittrich commented on GitHub (Jan 16, 2016): So far I don't support any completion after the opening parenthesis. Before we implement a new --list= command for that, I need to figure out how to solve this in general, with `unicode\( lc\( uc\(` added to the list of possible functions. If that works, I also need to consider `MD5\(` instead of `md5\(` etc.
Author
Owner

@frank-dittrich commented on GitHub (Jan 16, 2016):

@magnum if you want to test what I've got so far, see the commit github.com/frank-dittrich/JohnTheRipper@0ebcc1e184 to my git repo.

I don't know when I'll have time to continue this work, but I know that supporting additional functionality will get a lot harder.
I even failed at suggesting completions for --format=dynamic=gost\(.

The same completions as for --format=dynamic= should be suggested in a first step.
Adding unicode\( lc\( uc\( to that list is a second step.
Adding variable names is a third step.

The next step will be supporting completions containing at least one opening parenthesis, but not ending with a parenthesis.
Then may be add support for completion after the final closing parenthesis: ,debug or c1= etc,

Then we can think about implementing another --list= addition, to replace the hard coded lists with something automatically generated from dyna.

<!-- gh-comment-id:172259866 --> @frank-dittrich commented on GitHub (Jan 16, 2016): @magnum if you want to test what I've got so far, see the commit https://github.com/frank-dittrich/JohnTheRipper/commit/0ebcc1e184729ef5919a11ad8fd5e4909417e80d to my git repo. I don't know when I'll have time to continue this work, but I know that supporting additional functionality will get a lot harder. I even failed at suggesting completions for `--format=dynamic=gost\(`. The same completions as for `--format=dynamic=` should be suggested in a first step. Adding `unicode\( lc\( uc\(` to that list is a second step. Adding variable names is a third step. The next step will be supporting completions containing at least one opening parenthesis, but not ending with a parenthesis. Then may be add support for completion after the final closing parenthesis: `,debug` or `c1=` etc, Then we can think about implementing another --list= addition, to replace the hard coded lists with something automatically generated from dyna.
Author
Owner

@magnumripper commented on GitHub (Jan 16, 2016):

Tried it out a little. It's good help already. Maybe we shouldn't bother too much with things that are very hard to accomplish.

@jfoug is there a way to "get" a list of primitives (including lc, uc and so on) from dynamic, for eg. --list=dynamic-functions, or would it need to be hard-coded?

<!-- gh-comment-id:172267165 --> @magnumripper commented on GitHub (Jan 16, 2016): Tried it out a little. It's good help already. Maybe we shouldn't bother too much with things that are very hard to accomplish. @jfoug is there a way to "get" a list of primitives (including lc, uc and so on) from dynamic, for eg. `--list=dynamic-functions`, or would it need to be hard-coded?
Author
Owner

@frank-dittrich commented on GitHub (Jan 16, 2016):

@jfoug I wouldn't bother with such a list yet.
Once I have an idea how to solve the other bash completion issues, there's still enough time to implement various --list=dynamic-whatever lists.

<!-- gh-comment-id:172274310 --> @frank-dittrich commented on GitHub (Jan 16, 2016): @jfoug I wouldn't bother with such a list yet. Once I have an idea how to solve the other bash completion issues, there's still enough time to implement various `--list=dynamic-whatever` lists.
Author
Owner

@jfoug commented on GitHub (Jan 18, 2016):

@jfoug is there a way to "get" a list of primitives (including lc, uc and so on) from dynamic, for eg. --list=dynamic-functions, or would it need to be hard-coded?

@jfoug I wouldn't bother with such a list yet.
Once I have an idea how to solve the other bash completion issues, there's still enough time to implement various --list=dynamic-whatever lists.

Please do not hard code too much. I would much rather supply --list function somehow. That way when primitives are added, you would not have to make changes in this.

<!-- gh-comment-id:172569052 --> @jfoug commented on GitHub (Jan 18, 2016): > > @jfoug is there a way to "get" a list of primitives (including lc, uc and so on) from dynamic, for eg. --list=dynamic-functions, or would it need to be hard-coded? > > @jfoug I wouldn't bother with such a list yet. > Once I have an idea how to solve the other bash completion issues, there's still enough time to implement various --list=dynamic-whatever lists. Please do not hard code too much. I would much rather supply --list function somehow. That way when primitives are added, you would not have to make changes in this.
Author
Owner

@frank-dittrich commented on GitHub (Jan 18, 2016):

Of course, I would use a hard coded list only as long as I am trying to figure out how to implement tab completion inside a quoted string or after the first (. Currently, I can't get that working at all.
That's why implementing new --list= functionality isn't needed right now, since there is no user of such a functionality.

<!-- gh-comment-id:172575153 --> @frank-dittrich commented on GitHub (Jan 18, 2016): Of course, I would use a hard coded list only as long as I am trying to figure out how to implement tab completion inside a quoted string or after the first `(`. Currently, I can't get that working _at_ _all_. That's why implementing new --list= functionality isn't needed right now, since there is no user of such a functionality.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
openwall/john#1131
No description provided.