[GH-ISSUE #1152] --list problem #718

Closed
opened 2026-10-14 03:21:19 +07:00 by bsakaguchi · 3 comments
Owner

Originally created by @loverszhaokai on GitHub (Mar 26, 2015).
Original GitHub issue: https://github.com/openwall/john/issues/1152

This is not a segfault bug. But I think there is problem with --list.
#1. Prepare

1.1 content of 7z_fmt

$7z$0$19$0$1122$8$d1f50227759415890000000000000000$1412385885$112$112$5e5b8b734adf52a64c541a5a5369023d7cccb78bd910c0092535dfb013a5df84ac692c5311d2e7bbdc580f5b867f7b5dd43830f7b4f37e41c7277e228fb92a6dd854a31646ad117654182253706dae0c069d3f4ce46121d52b6f20741a0bb39fc61113ce14d22f9184adafd6b5333fb1

1.2 compile

$ ./configure && make -sj8
#2. Run
#2.1 no --list

$ ./john 7z_fmt

Loaded 1 password hash (7z, 7-Zip [SHA256 AES 32/64])
Will run 8 OpenMP threads
Note: This format may emit false positives, so it will keep trying even after
finding a possible candidate.
Press 'q' or Ctrl-C to abort, almost any other key for status
password (?)
#2.2 with --list

$ ./john 7z_fmt --list=inc-modes

Loaded 1 password hash (7z, 7-Zip [SHA256 AES 32/64])
Will run 8 OpenMP threads
digits
upper
lower
lowerspace
uppernum
lowernum
alpha
alnum
alnumspace
lanman
lm_ascii
ascii
latin1
utf8
custom
#3. Problem

3.1 Why still print message: "Loaded 1 password hash (7z, 7-Zip [SHA256 AES 32/64])" in 2.2 with --list?

3.2 I think "--list" can not combine with others parameters. John should report error message: "Invalid options combination or duplicate option: "--list=inc-modes" in 2.2 with --list.

Originally created by @loverszhaokai on GitHub (Mar 26, 2015). Original GitHub issue: https://github.com/openwall/john/issues/1152 This is not a segfault bug. But I think there is problem with --list. #1. Prepare ## 1.1 content of 7z_fmt $7z$0$19$0$1122$8$d1f50227759415890000000000000000$1412385885$112$112$5e5b8b734adf52a64c541a5a5369023d7cccb78bd910c0092535dfb013a5df84ac692c5311d2e7bbdc580f5b867f7b5dd43830f7b4f37e41c7277e228fb92a6dd854a31646ad117654182253706dae0c069d3f4ce46121d52b6f20741a0bb39fc61113ce14d22f9184adafd6b5333fb1 ## 1.2 compile $ ./configure && make -sj8 #2. Run #2.1 no --list $ ./john 7z_fmt Loaded 1 password hash (7z, 7-Zip [SHA256 AES 32/64]) Will run 8 OpenMP threads Note: This format may emit false positives, so it will keep trying even after finding a possible candidate. Press 'q' or Ctrl-C to abort, almost any other key for status password (?) #2.2 with --list $ ./john 7z_fmt --list=inc-modes **Loaded 1 password hash (7z, 7-Zip [SHA256 AES 32/64])** Will run 8 OpenMP threads digits upper lower lowerspace uppernum lowernum alpha alnum alnumspace lanman lm_ascii ascii latin1 utf8 custom #3. Problem 3.1 Why still print message: "**Loaded 1 password hash (7z, 7-Zip [SHA256 AES 32/64])**" in **2.2 with --list**? 3.2 I think "--list" **can not combine** with others parameters. John should report error message: "Invalid options combination or duplicate option: "--list=inc-modes" in **2.2 with --list**.
bsakaguchi 2026-10-14 03:21:19 +07:00
Author
Owner

@magnumripper commented on GitHub (Mar 26, 2015):

The --list commands are somewhat liberated in syntax on purpose, in order for bash completion (which is one of their main reason to exist) to be simpler. I'm not sure it's really necessary though. @frank-dittrich what do you think?

<!-- gh-comment-id:86368567 --> @magnumripper commented on GitHub (Mar 26, 2015): The --list commands are somewhat liberated in syntax on purpose, in order for bash completion (which is one of their main reason to exist) to be simpler. I'm not sure it's really necessary though. @frank-dittrich what do you think?
Author
Owner

@frank-dittrich commented on GitHub (Mar 26, 2015):

Yes, for bash completion of

$ ./john 7z_fmt --incremental=a[tab]

I use --list=inc-modes in the bash completion script.

I cannot just run ./john --list=inc-modes to find the possible completions, because that list depends on other command line options like --config=.

So, I kept all the command line options.
Because we ran into problems with this approach, the following commit dropped file names from the command line:

commit 4dc73c9247e1d96f560ad5c12a0aba8476860e54
Author: magnum <john.magnum@hushmail.com>
Date:   Thu Aug 21 02:19:40 2014 +0200

    When executing a "partial" john command during bash completion
    enumeration, do NOT include any input hash files. This seems to
    fix #701.

diff --git a/run/john.bash_completion b/run/john.bash_completion
index fa787a4..7a9e3d5 100644
--- a/run/john.bash_completion
+++ b/run/john.bash_completion
@@ -303,6 +303,9 @@ _john()
        fi
        COMPREPLY=()

+       # Drop any input files from the command to run for enumeration
+       COMP_LINE=`echo ${COMP_LINE}|sed -r "s# [^\-][^ ]+##g"`
+

This works, because john doesn't support file names starting with '-', anyway:

(bleeding-jumbo)run $ ./john --incremental -- -hashes.pomelo 
Unknown option: "-hashes.pomelo"

In this case, -hashes.pomelo is a file name.

./john --list=inc-modes -- -hashes.pomelo fails as well, but in this case, the script uses a fallback of just calling ./john --list=inc-modes to get the list of possible completions.

So, bash completion no longer needs that "liberated syntax".
We could either just avoid loading hashes if --list is used, or we could write something to stderr and exit.

Just in case Solar intends to fix the "file names starting with '-'" issue, we might need to adjust the "Drop any input files from the command" logic.

<!-- gh-comment-id:86435162 --> @frank-dittrich commented on GitHub (Mar 26, 2015): Yes, for bash completion of ``` $ ./john 7z_fmt --incremental=a[tab] ``` I use `--list=inc-modes` in the bash completion script. I cannot just run `./john --list=inc-modes` to find the possible completions, because that list depends on other command line options like `--config=`. So, I kept all the command line options. Because we ran into problems with this approach, the following commit dropped file names from the command line: ``` commit 4dc73c9247e1d96f560ad5c12a0aba8476860e54 Author: magnum <john.magnum@hushmail.com> Date: Thu Aug 21 02:19:40 2014 +0200 When executing a "partial" john command during bash completion enumeration, do NOT include any input hash files. This seems to fix #701. diff --git a/run/john.bash_completion b/run/john.bash_completion index fa787a4..7a9e3d5 100644 --- a/run/john.bash_completion +++ b/run/john.bash_completion @@ -303,6 +303,9 @@ _john() fi COMPREPLY=() + # Drop any input files from the command to run for enumeration + COMP_LINE=`echo ${COMP_LINE}|sed -r "s# [^\-][^ ]+##g"` + ``` This works, because john doesn't support file names starting with `'-'`, anyway: ``` (bleeding-jumbo)run $ ./john --incremental -- -hashes.pomelo Unknown option: "-hashes.pomelo" ``` In this case, `-hashes.pomelo` is a file name. `./john --list=inc-modes -- -hashes.pomelo` fails as well, but in this case, the script uses a fallback of just calling `./john --list=inc-modes` to get the list of possible completions. So, bash completion no longer needs that "liberated syntax". We could either just avoid loading hashes if `--list` is used, or we could write something to stderr and exit. Just in case Solar intends to fix the "file names starting with '-'" issue, we might need to adjust the "Drop any input files from the command" logic.
Author
Owner

@loverszhaokai commented on GitHub (Mar 26, 2015):

@frank-dittrich Thanks. I get it.

<!-- gh-comment-id:86449067 --> @loverszhaokai commented on GitHub (Mar 26, 2015): @frank-dittrich Thanks. I get it.
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#718
No description provided.