-
-
Save coreyja/8333db604b1532dd6c5c2c642daaa721 to your computer and use it in GitHub Desktop.
Viscosity Connect and Duo Push
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
# This is the alias to actually launch the AppleScript. | |
# Put this in your `.bash_profile` or wherever you like to keep aliases | |
# This assumes the AppleScript is located in `~/AppleScripts/autopush.applescript` | |
alias veep="osascript ~/AppleScripts/autopush.applescript" |
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
-- Will need to change the name to the VPN Client you wish to connect to | |
set vpnClientName to "Betterment VPN" | |
set viscosityWindowName to "Viscosity - " & vpnClientName | |
set afterWindowOpenDelay to 1 | |
tell application "Viscosity" to connect vpnClientName | |
tell application "System Events" | |
set duoPrompt to a reference to static text "Duo passcode or second factor:" of window viscosityWindowName of application process "Viscosity" | |
set mfaInputField to a reference to text field of window viscosityWindowName of application process "Viscosity" | |
set okButton to a reference to button "OK" of window viscosityWindowName of application process "Viscosity" | |
repeat until exists duoPrompt | |
delay 0.2 | |
end repeat | |
delay afterWindowOpenDelay -- This delay is annoying, but important. The push is never sent without it | |
set value of mfaInputField to "push" | |
click okButton | |
end tell |
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
# This will install tccutil https://github.com/jacobsalmela/tccutil | |
# for giving apps Accessibility Access then gives `osacript` and `iterm2` | |
# Accesibility Access to allow GUI interactions | |
brew install tccutil | |
sudo tccutil -i /usr/bin/osascript; sudo tccutil -e /usr/bin/osascript; | |
sudo tccutil -i com.googlecode.iterm2; sudo tccutil -e com.googlecode.iterm2; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment