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
#!/usr/bin/env sh | |
## | |
# This is script with usefull tips taken from: | |
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx | |
# | |
# install it: | |
# curl -sL https://raw.github.com/gist/3178087/hack.sh | sh | |
# |
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. Create a new generic password entry in Keychain Access called "WHATEVER_AnyConnect_VPN" (the name in Keychain access must match that in line 39 below) with your password for the Cisco AnyConnect VPN server. | |
-- 2. Modify values of vpnUrl and keychainKey variables | |
-- 3. 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. | |
-- 4. Open Security & Privacy System Preferences, go to Privacy, Accessibility. | |
-- 5. Enable the above .app so it can access Accessibility | |
-- 6. Copy and paste a nice icon on the generic Applescript icon (I used a copy of the default AnyConnect one) | |
-- 7. Add the new .app to /Users/[yourshortname]/Applications with a shortcut to your Dock | |
-- 8. Enjoy the fast connection with no need to enter password and increased security of not having a sensitive password stored as plain text | |
-- 9. Run script again to close connection |
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
global vpn_url, keychain_key, app_title, connection_state_polling_interval | |
set app_title to "My AnyConnect VPN" | |
set vpn_url to "https://some.ssl.vpnserver" | |
set keychain_key to "My_AnyConnect_VPN" | |
set connection_state_polling_interval to 10 | |
(* Custom handlers *************************************************************) | |
on is_connected() | |
set command_output to do shell script "/opt/cisco/anyconnect/bin/vpn status" | |
log command_output |
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
on alfred_script(q) | |
tell application "Amphetamine" | |
set sessionActiveTest to session is active | |
if sessionActiveTest is false then | |
if (q is not in {"", null}) then | |