Created
October 20, 2014 14:14
-
-
Save bborysenko/2d0839e7cca686383176 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
#!/bin/bash | |
# | |
# Copyright (C) 2014 by Red Hat | |
host=${1:-127.0.0.1} | |
port=${2:-443} | |
timeout_bin=`which timeout 2>/dev/null` | |
echo -n "$host:$port - " | |
out="`echo 'Q' | ${timeout_bin:+$timeout_bin 5} openssl s_client -ssl3 -connect "${host}:${port}" 2>/dev/null`" | |
if [ $? -eq 124 ]; then | |
echo "error: Timeout connecting to host!" | |
exit 1 | |
fi | |
if ! echo "$out" | grep -q 'Cipher is' ; then | |
echo 'Not vulnerable. Failed to establish SSL connection.' | |
exit 0 | |
fi | |
proto=`echo "$out" | grep '^ *Protocol *:' | awk '{ print $3 }'` | |
cipher=`echo "$out" | grep '^ *Cipher *:' | awk '{ print $3 }'` | |
if [ "$cipher" = '0000' -o "$cipher" = '(NONE)' ]; then | |
echo 'Not vulnerable. Failed to establish SSLv3 connection.' | |
exit 0 | |
else | |
echo "Vulnerable! SSLv3 connection established using $proto/$cipher" | |
exit 1 | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment