Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
PIA Port Forwarding For Transmission
#!/usr/bin/env bash
# Enable port forwarding when using Private Internet Access
echo 'Loading port forward assignment information...'
pia_client_id=`head -n 100 /dev/urandom | sha256sum | tr -d " -"` forwarded_port=$(curl "\?client_id=$pia_client_id" 2>/dev/null | awk -F ':' '{ print $2 }'| awk -F '}' '{ print $1 }')
json=`curl "$client_id" 2>/dev/null`
if [ "$json" == "" ]; then
echo "Port forwarding is already activated on this connection, has expired, or you are not connected to a PIA region that supports port forwarding"
echo $forwarded_port
transmission-remote -p $forwarded_port
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment