Skip to content

Instantly share code, notes, and snippets.

Created April 8, 2013 02:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save anonymous/5333853 to your computer and use it in GitHub Desktop.
Save anonymous/5333853 to your computer and use it in GitHub Desktop.
Port forwarding for Transmission and Private Internet Access. Replace PIA-USERNAME and PIA-PASSWORD with your private internet access account user/pass.
set user to "PIA-USERNAME"
set pass to "PIA-PASSWORD"
set macAddHash to do shell script "/sbin/ifconfig en0 | /usr/bin/awk '/ether / {print $2}' | /usr/bin/tr -d ':' | md5 "
set vpn_ip to do shell script "ifconfig tun0 | grep inet | awk '{print $2}'"
set vpn_port to do shell script "curl -d \"user=" & user & "&pass=" & pass & "&client_id=" & macAddHash & "&local_ip=" & vpn_ip & "\" https://www.privateinternetaccess.com/vpninfo/port_forward_assignment | grep -oE \"[0-9]+\""
do shell script "defaults write org.m0k.transmission BindPort " & vpn_port & ""
do shell script "defaults delete org.m0k.transmission BindPort"
do shell script "defaults write org.m0k.transmission BindPort " & vpn_port & ""
@indolering
Copy link

Download raw gist and open it with the AppleScript editor. Run this whenever you open Transmission.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment