My Bashrc File For Logging IP Changes

View previous topic View next topic Go down

My Bashrc File For Logging IP Changes

Post by jamied_uk on 20th May 2016, 14:23

Code:
currency_convert() {
curl -s "http://www.google.com/finance/converter?a=$1&from=$2&to=$3" | sed '/res/!d;s/<[^>]*>//g';
}

function show_ip(){
a=$(md5deep -q last_ip.txt)
echo -en "\e[92mYour IP's: \c"
echo ""
echo -n "Your Internal IP Is "
ifconfig eth0 | grep "inet addr"| sed 's/addr:/ /' | awk '{print $2}'
echo -n "Your External IP Is "
dig +short myip.opendns.com @resolver1.opendns.com
log_last_ip > last_ip.txt
#md5sum last_ip.txt > last_ip_hash.txt
b=$(md5deep -q last_ip.txt)
[ "$a" = "$b" ] && echo  "IP Not Changed" || echo "IP Has Changed Sinse Last Checked!"
}

function log_last_ip(){
echo -en "\e[92mYour IP's: \c"
echo ""
echo -n "Your Internal IP Is "
ifconfig eth0 | grep "inet addr"| sed 's/addr:/ /' | awk '{print $2}'
echo -n "Your External IP Is "
dig +short myip.opendns.com @resolver1.opendns.com
}

you will need root access and you will need to install the following:

Code:
sudo apt-get install -y md5deep



Full Link
http://jnet.forumn.biz/t1212-md5deep-linux-file-size-tools#1632


Last edited by jamied_uk on 20th May 2016, 15:02; edited 1 time in total
avatar
jamied_uk
Admin

Posts : 2199
Join date : 2010-05-09
Age : 34
Location : UK

http://address-shortner.co.uk

Back to top Go down

Re: My Bashrc File For Logging IP Changes

Post by jamied_uk on 20th May 2016, 14:28

Editing your .bashrc file



then open bash rc file copy the contents into your .bashrc file with the following


Code:
sudo gedit .bashrc
avatar
jamied_uk
Admin

Posts : 2199
Join date : 2010-05-09
Age : 34
Location : UK

http://address-shortner.co.uk

Back to top Go down

Re: My Bashrc File For Logging IP Changes

Post by jamied_uk on 20th May 2016, 14:59

Box Update Code Link

https://app.box.com/s/8601md24r29lk0s1djc9vke2deh2wtp6
avatar
jamied_uk
Admin

Posts : 2199
Join date : 2010-05-09
Age : 34
Location : UK

http://address-shortner.co.uk

Back to top Go down

Re: My Bashrc File For Logging IP Changes

Post by Sponsored content


Sponsored content


Back to top Go down

View previous topic View next topic Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum