Skip to content

Instantly share code, notes, and snippets.

@kaazoo
Created January 16, 2018 16:28
Show Gist options
  • Save kaazoo/d44bbf3ac1afdddb39b84b2c85b11f84 to your computer and use it in GitHub Desktop.
Save kaazoo/d44bbf3ac1afdddb39b84b2c85b11f84 to your computer and use it in GitHub Desktop.
run_openconnect.scpt
set myfile to (POSIX file "/Users/MY_ACCOUNT/.vpn_pin")
open for access myfile
set vpn_pin to (read myfile)
close access myfile
set vpn_pin to text 1 thru -2 of vpn_pin
set vpn_token to text returned of (display dialog "Token:" default answer "")
tell application "Terminal"
do script "echo " & vpn_pin & vpn_token & " | sudo openconnect -v --authgroup MY_PROFILE -u MY_ACCOUNT --passwd-on-stdin MY_ENDPOINT"
end tell
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment