-
-
Save com30n/9101c4c44ab7f86b8f742a4a246ffc5e to your computer and use it in GitHub Desktop.
Fix syntax error
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
-- 1. To authorize via Touch ID you must apply this script: https://gist.github.com/RichardBronosky/31660eb4b0f0ba5e673b9bc3c9148a70 | |
-- 2. Create a new password entry in Keychain Access called "LDAP" with your ldap password | |
-- 3. Create a new password entry in Keychain Access called "2Factor" with your 2factor token | |
-- 4. Install oath-toolkit. (brew install oath-toolkit) | |
-- 5. Open this script in Script Editor (both this and the above are in the Applications->Utilities folder) and "Save as.." an Application (.app) with desired name. | |
-- 6. Open Security & Privacy System Preferences, go to Privacy, Accessibility. | |
-- 7. Enable the above .app so it can access Accessibility | |
-- 8. Add the new .app to /Users/[yourshortname]/Applications with a shortcut to your Dock | |
-- 9. Enjoy the fast connection with no need to enter password and increased security of not having a sensitive password stored as plain text. | |
set targetApp to "Cisco AnyConnect Secure Mobility Client" | |
set LDAPKeyChainKey to "LDAP" | |
set SecondFactorKeyChainKey to "2Factor" | |
tell application "System Events" | |
set processExists to exists process targetApp | |
end tell | |
if processExists is true then | |
tell application targetApp | |
quit | |
end tell | |
end if | |
tell application targetApp | |
activate | |
end tell | |
tell application "System Events" | |
repeat until (window 1 of process targetApp exists) | |
delay 1 | |
end repeat | |
repeat until (window 3 of process targetApp exists) | |
delay 1 | |
end repeat | |
tell process targetApp | |
set PSWD to do shell script "sudo /usr/bin/security find-generic-password -wl " & quoted form of LDAPKeyChainKey | |
set Token to do shell script "sudo /usr/bin/security find-generic-password -wl " & quoted form of SecondFactorKeyChainKey | |
set PSWD2 to do shell script "sudo /usr/local/bin/oathtool --totp -b -d 6 " & quoted form of Token | |
keystroke PSWD as text | |
keystroke tab | |
keystroke PSWD2 as text | |
keystroke return | |
end tell | |
end tell |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment