sslget (429B)
1 #!/bin/sh 2 # 3 # retrieve SSL certificate of a website 4 # it assumes 443 to be the default SSL port 5 6 [ -n "$TORIFY" ] && tor=torsocks 7 8 portnum=${2-443} 9 cert="$(echo | ${tor} openssl s_client -connect $1:$portnum 2>&1 | sed '/BEGIN CERT/,/END CERT/p;d')" 10 11 printf "%s\n" "$cert" 12 13 shift 14 case "$2" in 15 -fpr*) 16 printf "\n" 17 for i in sha256 sha1 md5; do 18 printf "%s\n" "$cert" | openssl x509 -noout -fingerprint -${i} 19 done 20 ;; 21 esac