- Install anyconnect command line tools
- Save vpn_htw.sh somewhere, like
~/.scripts
- put a new Alias in your .bashrc or .zshrc
alias htw="sudo bash ~/.scripts/vpn_htw.sh"
- Fill out your credentials in the
vpn_htw.sh
where commented - Source your rc file like
source .bashrc
- launch with
htw -c
Created
January 20, 2022 15:00
-
-
Save BlkPingu/79977b589a9da5936cb46d653f3227dd to your computer and use it in GitHub Desktop.
HTW Berlin Cisco any connect script
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/expect -f | |
arg1=$1 | |
#group options: | |
# 0) HTW-SSL-Split | |
# 1) HTW-SSL-VPN-Full | |
# 2) HTW-SSL-VPN-Split | |
export GROUP="HTW-SSL-VPN-Full" | |
#known hosts: | |
# - SSL-VPNCL-HTW | |
export HOSTS=("SSL-VPNCL-HTW" "vpncl.htw-berlin.de") | |
export USER=s0XXXXXX@htw-berlin.de # < HIER AUSFUELLEN | |
export PW=XXXXXXXXX # < HIER AUSFUELLEN | |
server_array=("s0XXXXXX@dt9.f4.htw-berlin.de" "s0XXXXXX@hadoop05.f4.htw-berlin.de") # < HIER AUSFUELLEN | |
command_array=("[c] - connect to htw-vpn" "[dc] - disconnect from htw-vpn") | |
function connect_cisco { | |
printf "$GROUP\n$USER\n$PW" | /opt/cisco/anyconnect/bin/vpn -s connect $HOST | |
} | |
function plist() { | |
name=$1[@] | |
b=$2 | |
a=("${!name}") | |
for i in "${a[@]}" | |
do | |
echo "$i" | |
done | |
} | |
if [ "$arg1" == "-c" ]; | |
then connect_cisco | |
elif [ "$arg1" == "-dc" ]; | |
then sudo pkill connect_cisco | |
ps -A | grep connect_cisco | |
else | |
printf "give args pls:\n" | |
plist command_array | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment