Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #! /usr/local/bin/bash
- #
- # Script based on Eric Rudd's script at https://forums.freenas.org/index.php?threads/guide-setting-up-transmission-with-openvpn-and-pia.24566/page-2#post-174778
- #
- # Make sure you have a file named piacreds in the same directory as the script
- # 1st line of the file is pia username, 2nd password and third client id
- #
- # to generate a new client id run
- # head -n 100 /dev/urandom | md5sum | tr -d " -"
- # in any terminal
- #
- SCRIPTDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
- PROGRAM=`basename $0`
- USER=`head -n 1 $SCRIPTDIR/piacreds`
- PASSWORD=`head -n 2 $SCRIPTDIR/piacreds | tail -1`
- CLIENT_ID=`head -n 3 $SCRIPTDIR/piacreds | tail -1`
- local_ip=`ifconfig tun0 | grep "inet " | cut -d\ -f2|tee /tmp/vpn_ip`
- json=`wget --no-check-certificate -q --post-data="user=$USER&pass=$PASSWORD&client_id=$CLIENT_ID&local_ip=$local_ip" -O - "https://www.privateinternetaccess.com/vpninfo/port_forward_assignment" | head -1`
- PORTNUM=`echo $json | grep -oE "[0-9]+"`
- echo $PORTNUM
- transmission-remote -p $PORTNUM
- exit 0
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement