-
-
Save wei/51c19c9bae2d4584223852010bebde5a to your computer and use it in GitHub Desktop.
Revisions
-
wei revised this gist
Jul 28, 2017 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -3,7 +3,7 @@ # # Run this script once per minute # # * * * * * /path/to/whois-watch.sh google.com apple.com >> /var/log/whois-watch.log 2>&1 # update username in mail command # update sed command depending on server return text # -
wei revised this gist
Jul 28, 2017 . 1 changed file with 30 additions and 21 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -3,30 +3,39 @@ # # Run this script once per minute # # * * * * * /path/to/whois-watch.sh google.com apple.com # update username in mail command # update sed command depending on server return text # TMP_DIR="/tmp" function TIMESTAMP() { echo $(date -u +"%Y-%m-%d-%H:%M:%S") } NEWLINE=$'\n' for DOMAIN in "$@" do echo "[whois-watch.sh][$(TIMESTAMP)] Checking whois for $DOMAIN" OLD="$TMP_DIR/$DOMAIN.old.whois.txt" NEW="$TMP_DIR/$DOMAIN.new.whois.txt" DIFF="$TMP_DIR/$DOMAIN.whois.diff.txt" if [ ! -f $OLD ]; then echo "not available" > $OLD fi whois $DOMAIN -H | sed -e 's/^.*last update.*$//gI' > $NEW OLDHASH=$(sha1sum $OLD | awk '{print $1}') NEWHASH=$(sha1sum $NEW | awk '{print $1}') if [ "$OLDHASH" != "$NEWHASH" ]; then echo "[whois-watch.sh][$(TIMESTAMP)] $DOMAIN WHOIS Updated" diff $NEW $OLD > $DIFF mail -s "Whois information of $DOMAIN changed at $TIMESTAMP UTC" root < $DIFF rm $DIFF else echo "[whois-watch.sh][$(TIMESTAMP)] $DOMAIN WHOIS Hasn't Changed" fi mv $NEW $OLD done -
wei revised this gist
Jul 28, 2017 . 1 changed file with 14 additions and 13 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -6,26 +6,27 @@ # * * * * * /path/to/whois-watch.sh google.com # update username in mail command # update sed command depending on server return text # DOMAIN=$1 if [ -z "$DOMAIN" ]; then DOMAIN=GATECH.EDU fi OLD="/tmp/$DOMAIN.old.whois.txt" NEW="/tmp/$DOMAIN.new.whois.txt" DIFF="/tmp/$DOMAIN.whois.diff.txt" if [ ! -f $OLD ]; then echo "not available" > $OLD fi whois $DOMAIN | sed -e 's/^>>> Last update of whois database.*$//g' > $NEW OLDHASH=$(/sbin/md5 $OLD | awk '{print $4}') NEWHASH=$(/sbin/md5 $NEW | awk '{print $4}') if [ "$OLDHASH" != "$NEWHASH" ]; then echo "$DOMAIN WHOIS Updated" diff $NEW $OLD > $DIFF mail -s "Whois information of $DOMAIN changed" root < $DIFF rm $DIFF fi mv $NEW $OLD -
wei revised this gist
Jul 28, 2017 . 1 changed file with 2 additions and 4 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -16,11 +16,9 @@ if [ -z "$DOMAIN" ]; then fi if [ ! -f /tmp/$DOMAIN.old.whois.txt ]; then echo 'not available' > /tmp/$DOMAIN.old.whois.txt fi whois $DOMAIN | sed -e 's/^>>> Last update of whois database.*$//g' > /tmp/$DOMAIN.new.whois.txt OLDFILE=$(/sbin/md5 /tmp/$DOMAIN.old.whois.txt | awk '{print $4}') NEWFILE=$(/sbin/md5 /tmp/$DOMAIN.new.whois.txt | awk '{print $4}') -
wei revised this gist
Jun 29, 2016 . 1 changed file with 2 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -7,11 +7,12 @@ # update username in mail command # update sed command depending on server return text # optional terminal-notifier # May need to update whois script to bypass verisign's search results (e.g. whois -h whois.verisign-grs.com "domain google.com") # DOMAIN=$1 if [ -z "$DOMAIN" ]; then DOMAIN=GATECH.EDU fi if [ ! -f /tmp/$DOMAIN.old.whois.txt ]; then -
wei revised this gist
Jun 29, 2016 . 2 changed files with 32 additions and 26 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -1,26 +0,0 @@ This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,32 @@ #!/bin/bash # # Run this script once per minute # # * * * * * /path/to/whois-watch.sh google.com # update username in mail command # update sed command depending on server return text # optional terminal-notifier # DOMAIN=$1 if [ -z "$DOMAIN" ]; then DOMAIN=GOOGLE.COM fi if [ ! -f /tmp/$DOMAIN.old.whois.txt ]; then whois $DOMAIN | sed -e 's/^>>> Last update of whois database.*$//g' > /tmp/$DOMAIN.old.whois.txt echo 'not available' > /tmp/$DOMAIN.new.whois.txt else whois $DOMAIN | sed -e 's/^>>> Last update of whois database.*$//g' > /tmp/$DOMAIN.new.whois.txt fi OLDFILE=$(/sbin/md5 /tmp/$DOMAIN.old.whois.txt | awk '{print $4}') NEWFILE=$(/sbin/md5 /tmp/$DOMAIN.new.whois.txt | awk '{print $4}') if [ "$OLDFILE" != "$NEWFILE" ]; then diff /tmp/$DOMAIN.new.whois.txt /tmp/$DOMAIN.old.whois.txt > /tmp/$DOMAIN.whois.diff.txt mail -s "Whois information of $DOMAIN changed" root < /tmp/$DOMAIN.whois.diff.txt #/usr/local/bin/terminal-notifier -title "$DOMAIN WHOIS Updated" -execute "mail" < /tmp/$DOMAIN.whois.diff.txt #rm /tmp/$DOMAIN.whois.diff.txt fi mv /tmp/$DOMAIN.new.whois.txt /tmp/$DOMAIN.old.whois.txt -
zhovner created this gist
Jun 22, 2013 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,26 @@ #!/bin/bash # # Run this script once per day # DOMAIN="ZHOVNER.COM" if [ ! -f /tmp/$DOMAIN.old.whois.txt ]; then whois $DOMAIN | sed -e 's/^>>> Last update of whois database.*$//g' > /tmp/$DOMAIN.old.whois.txt exit 0 else whois $DOMAIN | sed -e 's/^>>> Last update of whois database.*$//g' > /tmp/$DOMAIN.new.whois.txt OLDFILE=$(md5sum /tmp/$DOMAIN.old.whois.txt | awk '{print $1}') NEWFILE=$(md5sum /tmp/$DOMAIN.new.whois.txt | awk '{print $1}') fi if [ "$OLDFILE" != "$NEWFILE" ]; then diff /tmp/$DOMAIN.new.whois.txt /tmp/$DOMAIN.old.whois.txt > /tmp/$DOMAIN.whois.diff.txt mail -s "Whois information of $DOMAIN changed" root < /tmp/$DOMAIN.whois.diff.txt mv /tmp/$DOMAIN.new.whois.txt /tmp/$DOMAIN.old.whois.txt rm /tmp/$DOMAIN.whois.diff.txt else mv /tmp/$DOMAIN.new.whois.txt /tmp/$DOMAIN.old.whois.txt fi