Skip to content

Instantly share code, notes, and snippets.

@filipenf
Last active August 29, 2015 14:07
Show Gist options
  • Save filipenf/b75761dbef109baa2be5 to your computer and use it in GitHub Desktop.
Save filipenf/b75761dbef109baa2be5 to your computer and use it in GitHub Desktop.
Test hosts by name
#!/bin/bash
zonefile=$1
zone=$2
test_hosts() {
for host in "$@"; do
host_=$(echo $host|awk -F ':' '{print $1}')
port_=$(echo $host|awk -F ':' '{print $2}')
echo | timeout 3 openssl s_client -connect $host_:$port_ >/dev/null 2>&1;
if [[ $? != 0 ]]; then
echo "UNKNOWN: $host timeout or connection error";
else
cipher=`echo | openssl s_client -connect $host_:$port_ -ssl3 2>&1 | grep "Cipher.*:" | awk -F':' '{print $2}' | tr -d ' '`
if [ "${cipher}" == '0000' ] || [ "$cipher" == "(NONE)" ]; then
echo "OK: $host Not vulnerable" ;
else
echo "FAIL: $host vulnerable; sslv3 connection accepted ( $cipher )";
fi
fi
done
}
for i in `cat $zonefile | awk '{print $1}' | grep -v ORIGIN |grep -v '^$' | grep -v '^@'`; do
/home/filipenf/proj/sandbox/snippets/tools/sslv3-test.sh $i.$zone:443 $i.$zone:8443;
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment