CiscoVPNSetup is the best automated way to connect to any VPN using Cisco VPN Anyconnect using Softoken generated PIN.
-
Substitute "server.example.com" and "YOURPIN" with your VPN server and Softoken PIN.
-
Save the modified code as "<any_name>.applescript" and store it anywhere and double click on it to launch Script Editor.
-
Click the "compile" icon ๐จ and from the File menu, click Save and choose "Application" as the "File format". Make sure Save as at the top is "any_name.app" without the quotes and save it in /Applications.
-
Open Security & Privacy in System Preferences, go to Privacy, Accessibility and Unlock the window. Click on + and add "Script Editor" & "any_name.app" (Or Just drag and drop your application to the window).
-
To add custom icon right-click on .app file and select "Show Package Content". Go to Contents/Resources and replace "applet.icns" file with your custom one (name should remain the same).
-
Launch the application from the /Applications and Run it again to Disconnect.
- Create a new generic password entry in Keychain Access called "cisco_vpn" (the name in Keychain access must match that in line 39 below) with your password for the Cisco AnyConnect VPN server. So this entry should have Name: cisco_vpn, and Account: cisco_vpn
- Change the username in line no #38 from "hapatel2" to
- Save the script as an Application if you want to use it permanently with some name and set it up on Dock to keep it handy.
- Open Security & Privacy System Preferences, go to Privacy, Accessibility and enable the above .app so it can access Accessibility
- Run the script to connect VPN automatically without clicking/typing anything.
- Run script again to close connection