-
- Posts: 22
- Joined: Thu Oct 29, 2015 6:30 am
So, I've been using the following AppleScript for awhile with Viscosity and PIA to automatically set port forwarding with Transmission and then yesterday it stopped working with Viscosity and yet continues to work with the PIA client. Any ideas why it stopped working with Viscosity? I'm running Mac OS 10.11.1 and Viscosity 1.6b3 (1319).
Code: Select all
# Set up a client ID and tuck it in a file in your home directory
# NOTE: Only do this once, to create the initial file, PIA wants us to reuse this value
# Open the terminal and do the following head -n 100 /dev/urandom | md5 > ~/.pia_client_id
# Substitue USERNAME and PASSWORD with your own account info in the command below
set vpn_ip to do shell script "ifconfig tun0 | grep inet | awk '{print $2}'" #get current ip of vpn interface
set vpn_port to do shell script "curl -d \"user=" & "NotActualUserName" & "&pass=" & "NotActualPassword" & "&client_id=$(cat ~/.pia_client_id)&local_ip=" & vpn_ip & "\" https://www.privateinternetaccess.com/vpninfo/port_forward_assignment 2>/dev/null|grep -oE \"[0-9]+\""
do shell script "defaults delete org.m0k.transmission BindPort" # delete previous port value
# Run the following in the terminal if you get an error: defaults write org.m0k.transmission BindPort "45678"
do shell script "defaults write org.m0k.transmission BindPort " & vpn_port & ""
do shell script "defaults delete org.m0k.transmission BindAddressIPv4" #delete previously written ipv4binding value
# Run the following in the terminal if you get an error: defaults write org.m0k.transmission BindAddressIPv4 "192.168.0.123"
do shell script "defaults write org.m0k.transmission BindAddressIPv4 " & vpn_ip & "" #write current vpn ip into transmission.plistUsername