Skip to content

Instantly share code, notes, and snippets.

@clearxlate
Created January 28, 2021 04:50
Show Gist options
  • Save clearxlate/27046c461a5c35c20b6cd96c409ba64b to your computer and use it in GitHub Desktop.
Save clearxlate/27046c461a5c35c20b6cd96c409ba64b to your computer and use it in GitHub Desktop.
#!/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
@clearxlate
Copy link
Author

add auth info to keychain:
security add-generic-password -a admin -s anyconnect -w **********

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment