Last active
May 14, 2021 16:53
-
-
Save shubhamgupta0122/012754889af30fa095890d9621047ec0 to your computer and use it in GitHub Desktop.
Revisions
-
shubhamgupta0122 revised this gist
May 14, 2021 . 1 changed file with 14 additions and 11 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,6 +1,7 @@ set toggle to %TOGGLE% set conf_name to "%NAME%" set conf_user to "%USER%" set conf_pass to "%PASS%" set conf_index to -1 if application "Tunnelblick" is running then @@ -21,14 +22,16 @@ tell application "Tunnelblick" if conf_index is -1 then return "configuration not found" else if toggle delete all credentials for conf_name save username conf_user for conf_name if (state of configuration conf_index) is "EXITING" then save password conf_pass for conf_name connect conf_name return "CONNECTING" else if (state of configuration conf_index) is "CONNECTED" then disconnect conf_name end if end if return state of configuration conf_index -
shubhamgupta0122 created this gist
May 14, 2021 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,36 @@ set conf_name to "my_tunnelblick_vpn_config_name" set conf_user to "username" set conf_pass to "secret_password" set conf_index to -1 if application "Tunnelblick" is running then else tell application "Tunnelblick" to activate end if tell application "Tunnelblick" -- finding index of configuration in Tunnelblick (applescript sucks) set all_conf_name to (get name of configurations) repeat with i from 1 to length of all_conf_name set curr_conf to item i of all_conf_name if curr_conf is conf_name then set conf_index to i end if end repeat if conf_index is -1 then return "configuration not found" else delete all credentials for conf_name save username conf_user for conf_name if (state of configuration conf_index) is "EXITING" then save password conf_pass for conf_name connect conf_name return "CONNECTING" else if (state of configuration conf_index) is "CONNECTED" then disconnect conf_name end if return state of configuration conf_index end if end tell