magnumripper/JohnTheRipper — pull request #464 by frank-dittrich (2014-01-05 15:06:30+00:00)
Title: --list=format-tests: Handle tests that contain line feed characters

Currently, scrypt format has a test where both the ciphertext
and the plaintext contain line feed characters and
horizontal tab characters.

Since .pot files don't work well with line breaks inside of
hashes or passwords, those problematic test cases are ignored.

If the ciphertext is OK, but the password contains a line feed,
the plaintext field is not written to stdout.
(The line just contains 3 fields in this case.)

If the ciphertext contains a line feed character, both the
ciphertext and the plaintext are suppressed.
(A line with just two fields will be written to stdout.)

If the ciphertext contains a separator character (currently '\t'),
the ciphertext and the plaintext will be suppressed.
(A line with just two fields will be written to stdout.)
Otherwise parsing the output of --list=format-tests would be
harder.

If just the plaintext contains separator characters, but no line feeds,
it will not be suppressed.

If some columns are suppressed due to line feed characters or separator
characters, a warning message is written to stderr.

$ ./john --list=format-tests --format=scrypt 2> /dev/null
scrypt	0	$7$C6..../....SodiumChloride$kBGj9fHznVYFQMEn/qDCfrDevf9YDtcDdKvEqHJLV8D	pleaseletmein
scrypt	1
scrypt	2	$7$2/..../....$rNxJWVHNv/mCNcgE/f6/L4zO6Fos5c2uTzhyzoisI62
scrypt	3	$7$86....E....NaCl$xffjQo7Bm/.SKRS4B2EuynbOLjAmXU5AbDbRXhoBl64	password

$ ./john --list=format-tests --format=scrypt > /dev/null
Test scrypt 1: plaintext contains line feed
Test scrypt 1: ciphertext contains line feed or separator character '	'