How To Use John The Ripper Tool In Linux For Cracking Passwords?

Anshul Kumar
3 min readJan 12, 2022

John The Ripper is one of the fastest hash cracking tools.

A quick overview of Hashes.

Your password is converted into a Hash format in the web-application database to provide protection to it everytime you log in or register.

Hashes use various Algorithms the widely known are MD5, SHA-1, and NTLM (Windows).

You have rockyou.txt already installed in your Linux.

Rockyou.txt is a wordlist of common passwords so-called dictionary.

For E:g- you have downloaded a Hash format file. Now you want to match if the hash matches your rockyou.txt database.

You can use this command:

John — format=[format] — wordlist=/usr/share/wordlists/rockyou.txt [you hash file in .txt]

You can check your hash format from this tool hashes.com

2. If you have Shadow files

Thinking of getting an etc/passwd file, etc/shadow file from the target machine.

Your etc/passwd contains (Name, Id, and etc), etc/shadow- (passwords in hash format for eg user:0ade45 and so on)

For cracking hashes or to unshadow the files, first of all, convert both files in .txt, then execute the command:

John — format=[format] — wordlist=/usr/share/wordlists/rockyou.txt [your passwd.txt] [shadow.txt]

3. Single Mode of Cracking

In this word mangling is used, meaning generating a password from username itself like name=user, password= User1&, 1User^, and it continues.

Let’s say you want to target a user with the username john, and you want to execute single crack mode.

John — single — format=[format] [hash.txt]

Make sure john: hashes format should be present in the file .txt

4. Protected .zip and .rar

First of all change the .zip and .rar to .txt through- zip2john .zip > .txt and same with .rar, rar2john .rar > .txt

Then once you get the key.

unzip or unrar the file in terminal using- unzip (file.zip) and unrar e (file.rar)

5. SSH Cracking

Some SSH uses id_rsa files key to authentication but using these files’ passwords is necessary.

The syntax is almost the same as ssh2john as in the above examples.

Command:

python3 /usr/share/john/ssh2john.py id_rsa.txt

6. Creating Your Own Rules

Some website uses the following rules when creating a password:

  1. The number should be there.
  2. There must be at least one or more capital letters.
  3. Any symbol

But your rockyou.txt contains the basic password.

For overcoming this, you can create your own rules.

The following steps will help you:-

  1. Give the name of your rules using [List. Rules:John]
  2. {Az} will execute after your password from rockyou.txt or another file.
  3. c will make your first letter capital.
  4. {A0} will come in front of your password.
  5. Use of brackets for perfect order [ ] and “ “(inside your brackets to your modified characters.

Your password may look like this following the above rules: cAz “[0–9] [symbols @#$]” for cracking = John23$

Command in Linux:

John — wordlist=/usr/share/wordlists/rockyou.txt — rule=john hash.txt

( — rule=john) is flag.

You can use this command for more help: etc/john/john.conf

I hope this guide helps you if you suck in between something you can drop a comment

or,

Tweet or message me here: https://twitter.com/4n5hulk

Thank you for being with me till here! If you guys want to support me you can do it from here: https://www.buymeacoffee.com/anshulk

:) Happy hacking.

--

--

Anshul Kumar

I am a full time Cybersecurity learner. Top 1% on TryHack me. Bug hunting is love. Here I share exciting stuff that I learn everyday.