As a result of this, I have written a quick script that compares my public IP with a dig query which sends me a DM via twitter to let me know when they are different.
Files below: digip, cihip (Can I Haz IP), dmpr4wn
You need dnsutils (for dig) and a working copy of TTYtter for this to work.
Files below: digip, cihip (Can I Haz IP), dmpr4wn
You need dnsutils (for dig) and a working copy of TTYtter for this to work.
Simply run digip every half hour or so and any discrepancy will be notified via twitter direct message.
Code:
#!/bin/sh# digip
DIG=$(dig prawn.mooo.com | grep ^prawn.mooo.com | awk '{ print $5 }')
CIH=$(cihip)
if [ "$CIH" == "" ]
then
echo "Public IP address is blank. Exiting."
exit 1
fi
if [ "$DIG" == "" ]
then
echo "DNS IP address is blank. Exiting."
exit 2
fi
if [ "$DIG" != "$CIH" ]
then
echo "Dig IP $DIG does not match public IP $CIH"
dmpr4wn "Dig IP $DIG does not match public IP $CIH"
else
echo "Dig IP $DIG matches public IP $CIH ok"
fi
###########################
#!/bin/sh
#cihip Can I haz IP
wget -qO - http://myip.dnsomatic.com/
echo
##########################
#!/bin/sh
#dmpr4wn
TWEET="/dm pr4wn"
ttytter -status="$TWEET $1" -hold

