Created
January 28, 2021 04:50
-
-
Save clearxlate/27046c461a5c35c20b6cd96c409ba64b to your computer and use it in GitHub Desktop.
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/bash | |
AUTHINFO=$(cat<<-EOM | |
y | |
admin | |
$(security find-generic-password -ws anyconnect) | |
EOM | |
) | |
if [ "$1" == "on" ] | |
then | |
echo "$AUTHINFO" | /opt/cisco/anyconnect/bin/vpn connect 10.0.0.10 -s | |
elif [ "$1" == "off" ] | |
then | |
/opt/cisco/anyconnect/bin/vpn disconnect | |
elif [ "$1" == "status" ] | |
then | |
/opt/cisco/anyconnect/bin/vpn state | grep -F ">>" | |
else | |
echo "$(basename $0) [ on | off | status ]" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
add auth info to keychain:
security add-generic-password -a admin -s anyconnect -w **********