Last active
January 14, 2018 10:21
-
-
Save royling/7b08bd0a2c979453fd751e6e9d6c06f4 to your computer and use it in GitHub Desktop.
AnyConnect CLI on macOS
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
#!/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