Skip to content

listconf.c: Optimize format list output (--list=formats) for pipes#6007

Open
magnumripper wants to merge 1 commit into
openwall:bleeding-jumbofrom
magnumripper:formatlist-comma
Open

listconf.c: Optimize format list output (--list=formats) for pipes#6007
magnumripper wants to merge 1 commit into
openwall:bleeding-jumbofrom
magnumripper:formatlist-comma

Conversation

@magnumripper

Copy link
Copy Markdown
Member

When scripting or writing "oneliners" the commas are just in the way and requires special handling. We now skip them and list one format per line if output is not a terminal.

$ ../run/john -list=formats -form=*crypt
descrypt, bsdicrypt, md5crypt, bcrypt, scrypt, adxcrypt, AxCrypt, BestCrypt, 
sha1crypt, sha256crypt, sha512crypt, django-scrypt, streebog256crypt, 
streebog512crypt, gost94crypt, Raw-SHA1-AxCrypt, sm3crypt, crypt
18 formats
$ ../run/john -list=formats -form=*crypt | wc -l
      18
$ ../run/john -list=formats -form=*crypt | grep ^sha
sha1crypt
sha256crypt
sha512crypt

When scripting or writing "oneliners" the commas are just in the way and
requires special handling.  We now skip them and list one format per line
if output is not a terminal.
@magnumripper
magnumripper requested a review from solardiz July 7, 2026 10:29

@solardiz solardiz left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I assume you tested this, so don't review the conditions very closely. I'd rename/invert stdout_is_pipe to stdout_is_tty (so also invert its checks later). Not a tty does not imply pipe - it can be various non-tty things.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants