> For the complete documentation index, see [llms.txt](https://pencer.gitbook.io/pencer-ctf-all-the-things/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://pencer.gitbook.io/pencer-ctf-all-the-things/enumeration-and-exploitation/cracking-hashes.md).

# Cracking Hashes

Use JohnTheRipper against lots of different types of hashes. Doesn't need a GPU so works well on a virtual machine.

This is useful to identify hash type:

{% embed url="<https://www.tunnelsup.com/hash-analyzer/>" %}

Can speed up JohnTheRipper if you tell it the correct hash type:

```bash
john --wordlist=/usr/share/wordlists/rockyou.txt --format=Raw-SHA256 hash.txt
```

#### PGP Key

Convert PGP key to John format:

```bash
gpg2john tryhackme.asc > tryhackme.asc.john
```

Crack it:

```bash
john --wordlist=/usr/share/wordlists/rockyou.txt tryhackme.asc.john
```

#### SSH

If we find an encrypted SSH private key, get sshng2john if needed and convert to John format:

```
curl -sk https://raw.githubusercontent.com/truongkma/ctf-tools/master/John/run/sshng2john.py > sshng2john.py
python sshng2john.py id_rsa > id_rsa.encrypted
```

Now we can try to crack it:

```
john --wordlist=/usr/share/wordlists/rockyou.txt id_rsa.encrypted
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://pencer.gitbook.io/pencer-ctf-all-the-things/enumeration-and-exploitation/cracking-hashes.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
