From f231fd9b62097dd44a7f08ea618dbc00e11b2f30 Mon Sep 17 00:00:00 2001 From: Silvio Rhatto Date: Fri, 25 Nov 2011 14:34:56 -0200 Subject: Added support for .br domains at domain-check --- files/bin/domain-check | 46 +++++++++++++++++++++++++++++++++++++--------- 1 file changed, 37 insertions(+), 9 deletions(-) diff --git a/files/bin/domain-check b/files/bin/domain-check index e307b89..869a438 100755 --- a/files/bin/domain-check +++ b/files/bin/domain-check @@ -4,10 +4,13 @@ # # Author: Matty < matty91 at gmail dot com > # -# Current Version: 1.8 +# Current Version: 1.9 # # Revision History: # +# Version 1.9 +# Added support for .br domains -- Silvio Rhatto +# # Version 1.8 # Bug fix added $MAIL -- Vivek Gite # @@ -240,6 +243,10 @@ check_domain_status() then ${WHOIS} -h "whois.nic.uk" "${1}" > ${WHOIS_TMP} + elif [ "${TLDTYPE}" == "br" ]; # Brazil + then + ${WHOIS} -h "whois.nic.br" "${1}" > ${WHOIS_TMP} + elif [ "${TLDTYPE}" == "biz" ]; then ${WHOIS} -h "whois.neulevel.biz" "${1}" > ${WHOIS_TMP} @@ -266,6 +273,9 @@ check_domain_status() elif [ "${TLDTYPE}" == "jp" ]; then REGISTRAR=`cat ${WHOIS_TMP} | ${AWK} '/Registrant/ && $2 != "" { REGISTRAR=substr($2,1,17) } END { print REGISTRAR }'` + elif [ "${TLDTYPE}" == "br" ]; + then + REGISTRAR="registro.br" fi # If the Registrar is NULL, then we didn't get any data @@ -287,6 +297,9 @@ check_domain_status() elif [ "${TLDTYPE}" == "uk" ]; # for .uk domain then DOMAINDATE=`cat ${WHOIS_TMP} | awk '/Renewal date:/ { print $3 }'` + elif [ "${TLDTYPE}" == "br" ]; # for .br domain + then + DOMAINDATE=`cat ${WHOIS_TMP} | awk '/expires:/ { print $2 }'` elif [ "${TLDTYPE}" == "jp" ]; # for .jp 2010/04/30 then tdomdate=`cat ${WHOIS_TMP} | awk '/Expires on/ { print $3 }'` @@ -314,16 +327,31 @@ check_domain_status() fi #echo $DOMAINDATE # debug - # Whois data should be in the following format: "13-feb-2006" - IFS="-" - set -- ${DOMAINDATE} - MONTH=$(getmonth ${2}) - IFS="" - - # Convert the date to seconds, and get the diff between NOW and the expiration date - DOMAINJULIAN=$(date2julian ${MONTH} ${1#0} ${3}) + if [ "${TLDTYPE}" == "br" ]; # for .br domain + then + # Convert the date to seconds + DOMAINJULIAN=`date -d ${DOMAINDATE} "+%-m %-d %-Y"` + DOMAINJULIAN=`date2julian ${DOMAINJULIAN}` + else + # Whois data should be in the following format: "13-feb-2006" + IFS="-" + set -- ${DOMAINDATE} + MONTH=$(getmonth ${2}) + IFS="" + + # Convert the date to seconds + DOMAINJULIAN=$(date2julian ${MONTH} ${1#0} ${3}) + fi + + # Get the diff between NOW and the expiration date DOMAINDIFF=$(date_diff ${NOWJULIAN} ${DOMAINJULIAN}) + if [ "${TLDTYPE}" == "br" ]; # for .br domain + then + # Fix domain date for displaying + DOMAINDATE=`date -d ${DOMAINDATE} +"%m-%b-%Y"` + fi + if [ ${DOMAINDIFF} -lt 0 ] then if [ "${ALARM}" = "TRUE" ] -- cgit v1.2.3