I have viewed the other questions which, were helpful, but do not answer my problem. I am trying to write a script that can assist me with college work*. I have a file containing a hash which through, "trial and error" needs to be cracked to get the final answer. The instructions specifically require jtr jumbo edition, so the list of possible formats is large. I passed all the available formats to a file called "johnformats" that contain the formats 1 per line. I want this script to run like:

$ john hash.txt --format=[cat line 1 from johnformats] > johnout

then repeat through last format value

$ john hash.txt --format=[cat line 204 from johnformats] > johnout

My script looks like this:



exec 4> "$johnout"

while read -ru 3 LINE; do
    john "$(cat hash.txt)" --format="$LINE" >&4
done 3< "$johnformats"

When run using script the hash does not load:

stat: cat hash: No such file or directory

I have tried the following removing the $hash altogether to see if any of it works:

Password files required, but none specified

repeat 204 times telling me the other part works, but

john the ripper syntax requires the hash(s) from a file.

I just need to figure out how to get it to use the contents of "hash," for each $LINE.

*note my question is not how to crack it, it is how to write a script for the tool I am using to crack it. Scripting is encouraged, but not required,and has nothing to do with the assignment. I have not memorized every possible hash prefix, and this will save me from carpel tunnel.

  • Try john -format="$LINE" hash.txt >&4. And make sure the hash.txt file actually exists. – cbley Jun 14 '18 at 8:30

I do not understand the reason for the added complexity. What you actually want is:

john hash.txt --format=[cat line 1 from johnformats] > johnout
john hash.txt --format=[cat line 2 from johnformats] >> johnout
john hash.txt --format=[cat line 3 from johnformats] >> johnout


So, in a script, that would be:



while read line ; do
    john hash.txt --format="$line" >>$johnout
done < $johnformats

There should be no need to add the complecity of the addtional filedescriptors 3 and 4, and the "$(cat hash.txt)" does something completely different then adding hash.txt as an argument.

Ofcourse, the error message suggests that hash is used as argument, not hash.txt that is in the code above, and in also suggests that the file hash does not exist. Those are things that you want to check too.

  • Thank you. As I work out problems, I have noticed instead of simplifying I want to complicate things further. I must break this habit somehow. – S. Buster Jul 18 '18 at 8:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.