Skip to content

Instantly share code, notes, and snippets.

@royling
Last active January 14, 2018 10:21
Show Gist options
  • Save royling/7b08bd0a2c979453fd751e6e9d6c06f4 to your computer and use it in GitHub Desktop.
Save royling/7b08bd0a2c979453fd751e6e9d6c06f4 to your computer and use it in GitHub Desktop.
AnyConnect CLI on macOS
#!/bin/sh
USERNAME=user_name
HOST=vpn.example.com
vpn=/opt/cisco/anyconnect/bin/vpn
case "$1" in
connect )
shift
printf "$USERNAME\n$1\ny" | $vpn -s connect $HOST > /dev/null && echo Connected successfully!
;;
disconnect )
$vpn disconnect
;;
status )
$vpn state
;;
* )
# print usage
echo "$0 [-h] [command] [args]"
echo " -h print this usage info"
echo " connect <RSA passcode> connect with RSA passcode"
echo " disconnect disconnect if connected currently"
echo " status show current status"
;;
esac
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment