SSH Private key cracking
For cracking SSH private key, We will use john tool.
Steps for Cracking SSH key
Step 1: Generate SSH Hash from Private Key
We have to make ssh hash first from SSH key.
ssh2john id_rsa > ssh.hashStep 2: Clean SSH Hash File (Remove Filename Prefix)
This ssh.hash file will have name of file in the beginning. We have to remove that before cracking SSH key.
# Removing Username from hash and keeping only hash.
output=$(cat ssh.hash | cut -d ":" -f2)
echo $output > ssh.hash
cat ssh.hashStep 3: Cracking SSH hash with john
# Using only wordlist
john --wordlist=/usr/share/wordlists/rockyou.txt ssh.hash
# Using wordlist and custom rule:
john --wordlist=/usr/share/wordlists/rockyou.txt --rules=sshrules ssh.hashStep 4: Connect using SSH
Last updated