Tracking a dynamic IP
Ok so I wrote a bot and bounced it off a site. Here are the notes on that script: (coded in bourne)
#!/bin/bash
#time delay
delay=90000
while :
do
cd /home/rsmith
rm /home/rsmith/'Ubuntu One'/ip.txt
echo 'To: (email address)' > ip.txt
echo 'From: (email address)' >>ip.txt
echo 'Subject: NV0 Public Status' >>ip.txt
wget -qO- http://whatsmyip.net | grep 'Your IP is:' > ip1.txt
cat ip1.txt |cut -d: -f2 | cut -d'<' -f1 >>ip.txt
ssmtp (my email address) < ip.txt
echo "Retrived from whatsmyip.net"
cp ip.txt 'Ubuntu One' -v
echo "Copy of ip.txt to cloud complete"
ls -l /home/rsmith/'Ubuntu One'/ip.txt
echo "will sleep for $delay seconds"
sleep $delay
done
This will use wget to access a website that displays your web address on the screen. Then it will search the http code for that address. Once it has it, it will access gmail's ssmtp service (email send) and send it to you. The cat and cut -d(s) are to make it pretty. The delay, in seconds will set how often it will send your IP address.
or you could just use CURL:
ReplyDeletecurl ifconfig.me doh!!