Last active
October 16, 2015 00:27
-
-
Save jmoggr/6a182e7970067b588aff to your computer and use it in GitHub Desktop.
Checks for potential exploits in Diffie-Hellman key exchange in the sites that you access.
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 | |
declare -A all_connections | |
while true; do | |
new_connections=() | |
for i in $(netstat -natp 2>/dev/null | grep :443 | awk '{ print $5 }'); do | |
if [[ ! ${all_connections[$i]} ]]; then | |
all_connections[$i]=1 | |
new_connections+=($i) | |
fi | |
done | |
for i in "${new_connections[@]}"; do | |
output="$(openssl s_client -connect $i -cipher EDH 2>/dev/null </dev/null)" | |
if [ $? -eq 0 ]; then | |
name=$(echo "${output}" | grep -E "subject" | sed 's/^.*\/O=//' | sed 's/\/.*//' | sed 's/subject=//') | |
security=$(echo "${output}" | grep -E "Server Temp Key" | cut -d ' ' -f 5) | |
address=$(dig +short -x $(echo $i | sed 's/:.*//')) | |
if [[ $security -lt 2048 ]]; then | |
echo "orginization: " $name | |
echo "address: " $address | |
echo "security: " $security " bits" | |
echo "" | |
fi | |
fi | |
done | |
sleep 5 | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment