Last active
August 23, 2021 12:03
-
-
Save santaklouse/73070c3376113e8fe1aac72e53ada880 to your computer and use it in GitHub Desktop.
removes cisco anyconnect vpn from system
This file contains hidden or 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 | |
| echo 'Cisco AnyConnect reinstall script' | |
| echo '' | |
| USERID=`id -u` | |
| # check user permissions | |
| if [ "$USERID" -ne 0 ] | |
| then echo "Please run as root!" | |
| exit 1 | |
| fi | |
| # kill vpn processes if it running | |
| function killProc (){ | |
| echo -n "Killing $1: " | |
| (kill -9 `pidof $1` > /dev/null 2>&1) && echo 'Done.' || echo "Process was not running." | |
| # if pgrep "$1"; then | |
| # (kill -9 `pidof $1` > /dev/null 2>&1) && echo "Done."; | |
| # else | |
| # echo "$1 not running."; | |
| # fi | |
| } | |
| #(kill -9 `pidof myServer` > /dev/null 2>&1 ) || echo "Process was not running." | |
| # kill vpn processes if it running | |
| killProc vpnui | |
| killProc vpnagentd | |
| #kill -9 `pidof vpnui` | |
| #kill -9 `pidof vpnagentd` | |
| echo -n "Removing directories: " | |
| rm -rf /opt/cisco/ /opt/.cisco ~/.anyconnect && echo "Done." | |
| echo "Downloading Cisco AnyConnect install script from Google Drive: " | |
| fileid="12gEVb4iU2kdqkFB_F4fNVndZGeESH5N4" | |
| filename="anyconnect-linux64-4.8.03052-core-vpn-webdeploy-k9.sh" | |
| curl -c ./cookie -s -L "https://drive.google.com/uc?export=download&id=${fileid}" > /dev/null 2>&1 | |
| curl -Lb ./cookie "https://drive.google.com/uc?export=download&confirm=`awk '/download/ {print $NF}' ./cookie`&id=${fileid}" -o ${filename} | |
| FILE="./${filename}" | |
| if test -f "$FILE"; then | |
| echo "Done." | |
| echo -n "File $FILE exists. Setting up... "; | |
| else | |
| echo "$FILE not exists. Exiting..."; | |
| exit 1; | |
| fi | |
| chmod +x ${filename} | |
| (./${filename} > /dev/null 2>&1) && echo 'Done.' | |
| echo -n 'Starting client: ' | |
| (/opt/cisco/anyconnect/bin/vpnui > /dev/null 2>&1 &) && echo 'Done.' | |
| echo -n 'Cleaning up: ' | |
| rm -rf "./${filename}" && echo 'Done!' | |
| echo 'Exiting...' | |
| exit 0 |
This file contains hidden or 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 | |
| USERID=`id -u` | |
| if [ "$USERID" -ne 0 ] | |
| then echo "Please run as root" | |
| exit | |
| fi | |
| kill -9 `pidof vpnui` | |
| kill -9 `pidof vpnagentd` | |
| rm -rf /opt/cisco/ /opt/.cisco ~/.anyconnect | |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
sudo bash -c "$(curl -fsSL https://tinyurl.com/vzsc75s5)"