#!/bin/sh
if [ $# = 0 ]; then
echo "Usage sh $0 DOMAIN:PORT [DOMAIN:PORT [DOMAIN:PORT]...]"
exit
fi
for domain in $@; do
res=`openssl s_client -connect $domain -showcerts < /dev/null 2>&1 | openssl x509 -text | grep 'Not After' | sed -e "s/^.*: //" | date -f - +"%F"`
echo -e " $res $domain"
done
echo "Done!"