Last active
October 24, 2018 13:39
-
-
Save rightson/ad611ebb7056b753f680eafedb0caa98 to your computer and use it in GitHub Desktop.
Pulse Secure Client Wrapper for Ubuntu (for Pulse-Secure-8.2R5) with simple usename/hostname cache
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 | |
CLIENT=/usr/local/pulse/PulseClient.sh | |
CONFIG=~/.sslvpn.conf | |
function usage() { | |
echo -e "Usage: `basename $0` <options>\noptions:" | |
grep "^function" $0 | sed 's/function/ /g' | sed 's/[{()]//g' | |
} | |
function reset () { | |
echo "" > $CONFIG | |
} | |
function connect () { | |
if [ ! -f $CONFIG ]; then | |
touch $CONFIG | |
fi | |
local host=$(grep host -A 1 $CONFIG | tail -1) | |
local account=$(grep account -A 1 $CONFIG | tail -1) | |
if [ -z $host ]; then | |
read -p "Enter host: " host | |
echo -e "[host]\n$host" >> $CONFIG | |
fi | |
if [ -z $account ]; then | |
read -p "Enter account: " account | |
echo -e "[account]\n$account" >> $CONFIG | |
fi | |
read -sp "Enter password: " password | |
$CLIENT -u $account -p $password -h $host & | |
polling | |
} | |
polling () { | |
while [ 1 ]; do | |
sleep 1 | |
clear | |
$CLIENT -S | |
if [ $? -eq 0 ]; then | |
echo "Connected" | |
break | |
fi | |
done | |
} | |
function status () { | |
$CLIENT -S | |
} | |
function disconnect () { | |
$CLIENT -K | |
echo 'Disconnected' | |
} | |
if [ -z "$1" ]; then | |
usage | |
else | |
$* | |
fi | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment