Skip to content

Instantly share code, notes, and snippets.

@indolering
Forked from anonymous/set-port.scpt
Created April 8, 2013 02:50
Show Gist options
  • Save indolering/5333872 to your computer and use it in GitHub Desktop.
Save indolering/5333872 to your computer and use it in GitHub Desktop.
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 & ""
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment