Created
December 8, 2017 09:53
-
-
Save rolindroy/7049daacce3f8fbd50d7a904f9aa49c1 to your computer and use it in GitHub Desktop.
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 characters
-- Apple Script to connect VPN Client with Password and Safenet MobilePass OTP. | |
set vpn_name to "'VPN Connection 01'" | |
set user_name to "username" | |
set passwd to "Password" | |
tell application "MobilePASS" | |
activate | |
end tell | |
tell application "System Events" | |
tell table 1 of scroll area 1 of window "MobilePASS" of application process "MobilePASS" | |
select row 1 | |
end tell | |
click button "Copy Passcode" of window "MobilePASS" of application process "MobilePASS" | |
end tell | |
tell application "System Events" | |
set rc to do shell script "scutil --nc status " & vpn_name | |
if rc starts with "Connected" then | |
do shell script "scutil --nc stop " & vpn_name | |
else | |
set otp to the clipboard | |
do shell script "scutil --nc start " & vpn_name & " --user " & user_name | |
delay 1 | |
keystroke passwd | |
keystroke otp | |
keystroke return | |
end if | |
end tell | |
tell application "MobilePASS" | |
quit | |
end tell |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment