diff --git a/pandora_plugins/Internet Domains and WHOIS/domain_expiration_date.sh b/pandora_plugins/Internet Domains and WHOIS/domain_expiration_date.sh new file mode 100755 index 0000000000..b2bf8f9c8b --- /dev/null +++ b/pandora_plugins/Internet Domains and WHOIS/domain_expiration_date.sh @@ -0,0 +1,22 @@ +#!/bin/bash + +if [ $# -ne 1 ] +then + echo + echo "Usage: domain_expiration_date.sh " + echo "Returns the number of days to expiration date" + echo + exit +fi + +domain=$1 + +# Calculate days until expiration +expiration=`whois $domain |grep "Expiry Date:"| awk -F"Date:" '{print $2}'|cut -f 1` +expseconds=`date +%s --date="$expiration"` +nowseconds=`date +%s` +((diffseconds=expseconds-nowseconds)) +expdays=$((diffseconds/86400)) + +echo $expdays +