Last active
October 24, 2018 04:33
-
-
Save lukluk/67fd2c125d24ad8f46214be15213404d to your computer and use it in GitHub Desktop.
Mojave SUCK
This file contains 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 characters
#!/bin/bash | |
vpn_name=$1 | |
vpn_password=$(ga-cmd) | |
echo "$vpn_name,$vpn_password" | |
/usr/bin/osascript <<EOF | |
tell application "System Preferences" | |
reveal pane "Network" | |
activate | |
tell application "System Events" | |
tell process "System Preferences" | |
tell window 1 | |
-- select the specified row in the service list | |
repeat with r in rows of table 1 of scroll area 1 | |
if (value of attribute "AXValue" of static text 1 of r as string) contains "$vpn_name" then | |
select r | |
end if | |
end repeat | |
-- set the address & username / account name | |
-- note that this is vpn specific | |
tell group 1 | |
click button "Authentication Settings…" | |
end tell | |
-- open up the auth panel and set the login password | |
tell sheet 1 | |
set value of text field 2 to "$vpn_password" | |
delay 1 | |
click button "Ok" | |
end tell | |
delay 1 | |
click button "Apply" | |
delay 2 | |
tell group 1 | |
click button "Connect" | |
end tell | |
end tell | |
end tell | |
end tell | |
end tell | |
EOF |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
README BEFORE USE THAT SCRIPT
$ git clone https://github.com/arcanericky/ga-cmd.git
$ cd ga-cmd
$ git submodule init
$ git submodule update
$ make
$ ./build
SECRETKEY
$ cp bin/* /usr/local/bin