Created
July 13, 2017 16:47
-
-
Save commenthol/194ea40f6e3cabb458f73dc64fc46aac to your computer and use it in GitHub Desktop.
Test Cipher Suites, find TLS Protocols
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# | |
# From https://superuser.com/questions/109213/how-do-i-list-the-ssl-tls-cipher-suites-a-particular-website-offers | |
# | |
# Find cipher suites a website offers | |
# | |
# Usage | |
# | |
# ./test-ciphers.sh google.com:443 | |
SERVER=$1 | |
ciphers=$(openssl ciphers 'ALL:eNULL' | sed -e 's/:/ /g') | |
echo Obtaining cipher list from $(openssl version). | |
for cipher in ${ciphers[@]} | |
do | |
#echo -n Testing $cipher... | |
result=$(echo -n | openssl s_client -cipher "$cipher" -connect $SERVER 2>&1) | |
if [[ "$result" =~ ":error:" ]] ; then | |
error=$(echo -n $result | cut -d':' -f6) | |
echo -n Testing $cipher... | |
echo NO \($error\) | |
else | |
if [[ "$result" =~ "Cipher is ${cipher}" || "$result" =~ "Cipher :" ]] ; then | |
echo -n Testing $cipher... | |
echo YES | |
else | |
echo -n Testing $cipher... | |
echo UNKNOWN RESPONSE | |
echo $result | |
fi | |
fi | |
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# | |
# Find TLS Protocols | |
# | |
# Usage | |
# ./test-tls.sh google.com:443 | |
# | |
SERVER=$1 | |
protocols=(-ssl3 -tls1_2 -tls1_1 -tls1) | |
echo Using $(openssl version). | |
for proto in ${protocols[@]} | |
do | |
echo -n Testing $proto... | |
result=$(echo -n | openssl s_client -connect $SERVER $proto 2>&1) | |
if [[ "$result" =~ "no peer certificate available" ]] ; then | |
error=$(echo -n $result | cut -d':' -f6) | |
echo NO \($error\) | |
else | |
if [[ "$result" =~ "Cipher is ${cipher}" || "$result" =~ "Cipher :" ]] ; then | |
echo YES | |
else | |
echo UNKNOWN RESPONSE | |
echo $result | |
echo ---------------------------------------------------- | |
fi | |
fi | |
done | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment