Last active
February 15, 2023 16:00
-
-
Save pjperez/6ce7f726ccd752c3eeba to your computer and use it in GitHub Desktop.
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 | |
# OpenSSL requires the port number. | |
SERVER=$1:443 | |
# Delay after each test | |
DELAY=0 | |
# Ciphers to test | |
ciphers=$(openssl ciphers 'ALL:eNULL' | sed -e 's/:/ /g') | |
# Some nice colours :) | |
red='\e[0;31m' | |
green='\e[0;32m' | |
nocolour='\e[0m' | |
yellow='\e[1;33m' | |
echo Obtaining cipher list from $(openssl version). | |
#TEST ONLYTLS | |
echo -e Testing ${yellow}$SERVER${nocolour} + FORCE TLS | |
echo | |
for cipher in ${ciphers[@]} | |
do | |
echo -n Testing $cipher... | |
result=$(echo \t\r\n | openssl s_client -no_ssl2 -no_ssl3 -cipher "$cipher" -connect $SERVER 2>&1> /dev/null) | |
if echo "$result" | egrep -q "err" | |
then | |
if echo "$result" | egrep -q "unable" | |
then | |
echo -e ${green}SUPPORTED${nocolour} | |
else | |
echo -e ${red}UNSUPPORTED${nocolour} | |
fi | |
else | |
echo -e ${green}SUPPORTED${nocolour} | |
fi | |
sleep $DELAY | |
done | |
# Test NOTLS | |
echo | |
echo -e Testing ${yellow}$SERVER${nocolour} without TLS \(force SSL2 or SSL3\) | |
echo | |
for cipher in ${ciphers[@]} | |
do | |
echo -n Testing $cipher... | |
result=$(echo \t\r\n | openssl s_client -no_tls1 -cipher "$cipher" -connect $SERVER 2>&1> /dev/null) | |
if echo "$result" | egrep -q "err" | |
then | |
if echo "$result" | egrep -q "unable" | |
then | |
echo -e ${green}SUPPORTED${nocolour} | |
else | |
echo -e ${red}UNSUPPORTED${nocolour} | |
fi | |
else | |
echo -e ${green}SUPPORTED${nocolour} | |
fi | |
sleep $DELAY | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment