Skip to content

Instantly share code, notes, and snippets.

@sh1nu11bi
Created October 6, 2014 14:45
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sh1nu11bi/7adf4fba4d8093105de9 to your computer and use it in GitHub Desktop.
Save sh1nu11bi/7adf4fba4d8093105de9 to your computer and use it in GitHub Desktop.
SSL / SSH Private Key Passphase Cracker v1.0
#!/bin/bash
################################################################################
# ____ _ __ #
# ___ __ __/ / /__ ___ ______ ______(_) /___ __ #
# / _ \/ // / / (_-</ -_) __/ // / __/ / __/ // / #
# /_//_/\_,_/_/_/___/\__/\__/\_,_/_/ /_/\__/\_, / #
# /___/ team #
# #
# ssl-crack.sh - wordlist-based encrypted SSL and SSH Private Key Passphase #
# Cracker #
# #
# FILE #
# ssl-crack.sh #
# #
# DATE #
# 2013-08-31 #
# #
# DESCRIPTION #
# Loads a wordlist file into memory and reveals the password for the RSA #
# encrypted private SSL / SSH key #
# #
# AUTHOR #
# TheXero #
# #
################################################################################
WORDLIST='/home/thexero/lists/passwords.txt'
echo """
____ _ __
___ __ __/ / /__ ___ ______ ______(_) /___ __
/ _ \/ // / / (_-</ -_) __/ // / __/ / __/ // /
/_//_/\_,_/_/_/___/\__/\__/\_,_/_/ /_/\__/\_, /
/___/ team
*********************************************************************
SSL / SSH Private Key Passphase Cracker v1.0
*********************************************************************
"""
if [ -z "$1" ]
then
echo "Enter path to encrypted SSL / SSH private key"
read KEYFILE
else
KEYFILE=$1
fi
for PASSWORD in $(cat $WORDLIST);
do
if [[ -n $(echo -n $PASSWORD | openssl rsa -in $KEYFILE -passin stdin 2>&1 |
grep -v unable |grep -v error) ]]
then
echo -e 'Password for SSL / SSH Key is:' $PASSWORD
echo -n $PASSWORD | openssl rsa -in $KEYFILE -passin stdin 2>&1
exit
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment