# John The Ripper

## <mark style="color:yellow;">ABOUT</mark>

<mark style="color:red;">**John the Ripper (JTR or john)**</mark> is an essential <mark style="color:purple;">**pentesting tool**</mark> used to check the strength of passwords and crack encrypted (or hashed) passwords using either brute force or dictionary attacks. It is open-source software initially developed for UNIX-based systems and first released in **1996.**

## <mark style="color:yellow;">Cracking Modes</mark>

### <mark style="color:blue;">**Single Crack Mode**</mark>

Is one of the most common John modes used when attempting to crack passwords using a single password list. It is a **brute-force** attack which use single password list, meaning all passwords on the list are tried, one by one, until the correct one is found.

```bash
$ john --format=sha256 hashes_to_crack.txt
```

### <mark style="color:blue;">**Wordlist Mode**</mark>

Is used to crack passwords using multiple lists of words. It is a dictionary attack which means it will try all the words in the lists one by one until it finds the right one. It is almost same with **Single Crack Mode**, just uses custom wordlists.

```bash
$ john --wordlist=<wordlist_file> --rules <hash_file>
```

## <mark style="color:yellow;">**Incremental Mode**</mark>

is an advanced **John** mode used to crack passwords using a character set. It is a **hybrid attack**, which means it will attempt to match the password by trying all possible combinations of characters from the character set.

```bash
$ john --incremental <hash_file>
```

## <mark style="color:yellow;">**Cracking Files**</mark>

```bash
$ locate *2john #locate tools to make file crackable
$ pdf2john server_doc.pdf > server_doc.hash
$ john server_doc.hash
$ john --wordlist=<wordlist.txt> server_doc.hash
```

## <mark style="color:yellow;">2JOHN</mark>

John sometimes can't crack files without proper formatting, and for this reason there are a lot of scripts to change format into **john-crackable** one.

```bash
locate *2john
```

After converting we could crack it with basic command:

<pre class="language-bash"><code class="lang-bash">ssh2john.py id_rsa > ssh.hash #changing file to crackable type
<strong>john --wordlist=rockyou.txt ssh.hash #cracking
</strong>john ssh.hash --show #show password if cracked succesfully
</code></pre>
