Advertisement
Guest User

Untitled

a guest
Aug 30th, 2016
133
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.96 KB | None | 0 0
  1. #! /bin/bash
  2.  
  3. #quit deluge
  4. /root/vpn/close.sh
  5.  
  6. USERNAME=foo
  7. PASSWORD=bar
  8. LOCAL_IP=`ifconfig tun0|grep -oE "inet addr: *10\.[0-9]+\.[0-9]+\.[0-9]+"|tr -d "a-z :"|tee /tmp/vpn_ip`
  9. CLIENT_ID=`head -n 100 /dev/urandom | md5sum | tr -d " -"`
  10.  
  11. echo "user=$USERNAME&pass=$PASSWORD&client_id=$CLIENT_ID&local_ip=$LOCAL_IP"
  12.  
  13. TMP_PORT=$(curl -d "user=$USERNAME&pass=$PASSWORD&client_id=$CLIENT_ID&local_ip=$LOCAL_IP" https://www.privateinternetaccess.com/vpninfo/port_forward_assignment)
  14.  
  15. PORT=$(echo $TMP_PORT | sed "s/[^0-9]*//g")
  16.  
  17. if [ "$PORT" != "" ]
  18. then
  19. echo "starting web"
  20. start deluge-web
  21. echo "starting deluged"
  22. start deluged
  23.  
  24. echo "setting port ($PORT) on deluge"
  25. sleep 5
  26. /usr/bin/deluge-console "config --set listen_ports ($PORT,$PORT)"
  27. /etc/init.d/deluged force-reload
  28.  
  29. #store port
  30. echo "$PORT" > /root/PIAport
  31. else
  32. echo "failed to get port from PIA"
  33. fi
  34.  
  35. exit 0
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement