Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- #changes to script directory & creates file in case aint existing
- cd ~/.sec/
- touch ip_log
- #declares ftp variables to connect & upload
- host='aiprep.dx.am'
- user="2113475"
- pass="0k0k0k0k!!"
- file="ip_log"
- path='/aiprep.dx.am/'
- #declares a few shit variables
- new_ip=$(wget -qO- http://ipecho.net/plain)
- now=$(date)
- last_ip=$(sed -n '1p' ip_log)
- since=$(sed -n '2p' ip_log)
- prev=$(tail -n +3 ip_log)
- #checks the current ip with the last one, if it differs it adds a line
- if [ $new_ip = $last_ip ]; then
- echo no changes yet
- else
- echo modifying
- echo -e "$new_ip\n$now\n$last_ip @ $since\n$prev" > ip_log
- fi
- #uploads the whole shit
- ftp -p -n $host <<END_SCRIPT
- quote USER $user
- quote PASS $pass
- cd $path
- put $file
- quit
- END_SCRIPT
- exit 0
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement