Advertisement
Guest User

Untitled

a guest
May 2nd, 2016
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.77 KB | None | 0 0
  1. #!/bin/bash
  2. #changes to script directory & creates file in case aint existing
  3. cd ~/.sec/
  4. touch ip_log
  5.  
  6. #declares ftp variables to connect & upload
  7. host='aiprep.dx.am'
  8. user="2113475"
  9. pass="0k0k0k0k!!"
  10. file="ip_log"
  11. path='/aiprep.dx.am/'
  12.  
  13. #declares a few shit variables
  14. new_ip=$(wget -qO- http://ipecho.net/plain)
  15. now=$(date)
  16. last_ip=$(sed -n '1p' ip_log)
  17. since=$(sed -n '2p' ip_log)
  18. prev=$(tail -n +3 ip_log)
  19.  
  20. #checks the current ip with the last one, if it differs it adds a line
  21. if [ $new_ip = $last_ip ]; then
  22. echo no changes yet
  23. else
  24. echo modifying
  25. echo -e "$new_ip\n$now\n$last_ip @ $since\n$prev" > ip_log
  26. fi
  27.  
  28. #uploads the whole shit
  29. ftp -p -n $host <<END_SCRIPT
  30. quote USER $user
  31. quote PASS $pass
  32. cd $path
  33. put $file
  34. quit
  35. END_SCRIPT
  36. exit 0
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement