optische anpassungen
This commit is contained in:
parent
95479bf28c
commit
60126dc275
43
bibVPN.sh
43
bibVPN.sh
@ -13,9 +13,9 @@
|
||||
# <xbar.author.github>jessejoe</xbar.author.github>
|
||||
# <xbar.desc>Displays status of a VPN interface with option to connect/disconnect.</xbar.desc>
|
||||
# <xbar.image>http://i.imgur.com/RkmptwO.png</xbar.image>
|
||||
|
||||
###################
|
||||
#### Variables ####
|
||||
#DIR="/Users/$USER/Library/Preferences/openconnect"
|
||||
###################
|
||||
WORKDIR="/Users/$USER/.openconnect"
|
||||
mkdir -p $WORKDIR
|
||||
logfile="$WORKDIR/bibVPN.log"
|
||||
@ -26,21 +26,10 @@ VPN_EXECUTABLE=$(which openconnect)
|
||||
OC_PIDFILE="$WORKDIR/vpn.bib.de.pid"
|
||||
SETTINGSFILE="$WORKDIR/settings.csv"
|
||||
ACCOUNTFILE="$WORKDIR/accounts.csv"
|
||||
VPN_HOST="$3"
|
||||
VPN_USERNAME="$2"
|
||||
#### Settings ####
|
||||
SHOW_SETTINGS='OFF'
|
||||
SET_ICONS='no'
|
||||
NET_FILTER='inet 172.[123][0-9].1[67][80].'
|
||||
FONT=( 'size=14' 'font=UbuntuMono' )
|
||||
#### Icons ####
|
||||
ICON_connected="iVBORw0KGgoAAAANSUhEUgAAABgAAAAWCAYAAAGtemweAAAACXBIWXMAAAsSAAALEgHS3X78AAAA+klEQVR4nNRUwQ2DMAzMKy8WYIZOwb8LtUtAJSZp34zBCn3y4Y3cWLEr13KSllKhnnRKcvHZ4AScS6BJbUSMgRCncfJcaBG0KMcvMIj83ircWcUh9VTI46onO1A75sC2FIjpT0qHwMUy4AZSzuU6a7D2smDzLRu1Fi11aKRGJOHVyzKHlGExXu5MmlkJ6HpfRHbWx5SBR+tMtjNYOuQMfGV5Lecm8HSLQf8BH9iLC2BxoRiM/Qi9SnSlS1MRG9VLIM/bH4NM7Cgp/rImYkeaU4XQW8QsDBVpk9GeSRRnDb1FyCSWVtovYpcCtZG83rLALzwvuKskSNT2xwMAAP//L6vzxgAAAAJJREFUAwBX1u55AAAAAElFTkSuQmCC"
|
||||
ICON_disconnected="iVBORw0KGgoAAAANSUhEUgAAABgAAAAWCAYAAAGtemweAAAACXBIWXMAAAsSAAALEgHS3X78AAAA2klEQVR4nNxTQQ6DMAyrqvGAXfeK7Uh5wHbgyhlxaP//hDXClbLOXUHqhDZLFsGJEzUUYwq4lBIrpsiwhirQEDHxRSw69mFU/a1OJNHh+ZYILMHibThjHUtkXyuU9tdMD5GeGSQh1LF+/2hguQPRY0MTFlGEzQ6bOJYMnhzuBo1OCrjejqx0KhnSk32TdgamhyaGP4SNHNQFYPSokdpdGLJGd1yaDpT4kdWIZ/PPoBsLTriRM+igmWyQeKtYlKGDNpP1iGZQkzTxVqGbMK2Wr+KQAU09Xx/wW3gCAAD//+SvwXMAAAACSURBVAMAV9bueQAAAABJRU5ErkJggg=="
|
||||
# A command that will result in your VPN password. Recommend using
|
||||
# "security find-generic-password -g -a foo" where foo is an account
|
||||
# in your OSX Keychain, to avoid passwords stored in plain text
|
||||
VPN_HOST="$3"
|
||||
# A command that will result in your VPN password.
|
||||
GET_VPN_PASSWORD="security find-generic-password -g -a $VPN_USERNAME 2>&1 >/dev/null | cut -d'\"' -f2"
|
||||
|
||||
# Command to determine if VPN is connected or disconnected
|
||||
VPN_CONNECTED="ifconfig | egrep -A1 '$NET_FILTER' |cut -d' ' -f2"
|
||||
# Command to run to disconnect VPN
|
||||
@ -48,7 +37,19 @@ VPN_DISCONNECT_CMD="sudo killall -2 openconnect"
|
||||
# Get IP of Current VPN Tunnel
|
||||
IP=$(ifconfig | egrep -A1 "$NET_FILTER" |cut -d' ' -f2)
|
||||
|
||||
#### Settings ####
|
||||
SHOW_SETTINGS='OFF'
|
||||
SET_ICONS='no'
|
||||
NET_FILTER='inet 172.[123][0-9].1[67][80].'
|
||||
FONT=( 'size=14' 'font=UbuntuMono' )
|
||||
|
||||
#### Icons ####
|
||||
ICON_connected="iVBORw0KGgoAAAANSUhEUgAAABgAAAAWCAYAAAGtemweAAAACXBIWXMAAAsSAAALEgHS3X78AAAA+klEQVR4nNRUwQ2DMAzMKy8WYIZOwb8LtUtAJSZp34zBCn3y4Y3cWLEr13KSllKhnnRKcvHZ4AScS6BJbUSMgRCncfJcaBG0KMcvMIj83ircWcUh9VTI46onO1A75sC2FIjpT0qHwMUy4AZSzuU6a7D2smDzLRu1Fi11aKRGJOHVyzKHlGExXu5MmlkJ6HpfRHbWx5SBR+tMtjNYOuQMfGV5Lecm8HSLQf8BH9iLC2BxoRiM/Qi9SnSlS1MRG9VLIM/bH4NM7Cgp/rImYkeaU4XQW8QsDBVpk9GeSRRnDb1FyCSWVtovYpcCtZG83rLALzwvuKskSNT2xwMAAP//L6vzxgAAAAJJREFUAwBX1u55AAAAAElFTkSuQmCC"
|
||||
ICON_disconnected="iVBORw0KGgoAAAANSUhEUgAAABgAAAAWCAYAAAGtemweAAAACXBIWXMAAAsSAAALEgHS3X78AAAA2klEQVR4nNxTQQ6DMAyrqvGAXfeK7Uh5wHbgyhlxaP//hDXClbLOXUHqhDZLFsGJEzUUYwq4lBIrpsiwhirQEDHxRSw69mFU/a1OJNHh+ZYILMHibThjHUtkXyuU9tdMD5GeGSQh1LF+/2hguQPRY0MTFlGEzQ6bOJYMnhzuBo1OCrjejqx0KhnSk32TdgamhyaGP4SNHNQFYPSokdpdGLJGd1yaDpT4kdWIZ/PPoBsLTriRM+igmWyQeKtYlKGDNpP1iGZQkzTxVqGbMK2Wr+KQAU09Xx/wW3gCAAD//+SvwXMAAAACSURBVAMAV9bueQAAAABJRU5ErkJggg=="
|
||||
|
||||
###################
|
||||
#### Functions ####
|
||||
###################
|
||||
function askFor(){
|
||||
osascript=$1+' buttons {"Cancel","OK"} default button {"OK"} with title "Neuen User für das VPN anlegen"'
|
||||
results=$( /usr/bin/osascript -e $osascript)
|
||||
@ -72,16 +73,18 @@ function showSettings()
|
||||
echo "--Neuen User anlegen| shell='$0' param1=newuser terminal=false refresh=true"
|
||||
fi
|
||||
}
|
||||
|
||||
#### MAIN #####
|
||||
###################
|
||||
###### MAIN #######
|
||||
###################
|
||||
case "$1" in
|
||||
connect)
|
||||
VPN_PASSWORD=$(eval "$GET_VPN_PASSWORD")
|
||||
if [[ -z VPN_PASSWORDm ]]; then VPN_PASSWORD=$(askFor 'display dialog "Es ist kein Passwort im Schlüsselbund vorhanden. Wie lautet das Passwort? " default answer "vpn.bib.de"'); fi
|
||||
# Passwort checken
|
||||
#if [[ -z VPN_PASSWORD ]]; then VPN_PASSWORD=$(askFor 'display dialog "Es ist kein Passwort im Schlüsselbund vorhanden. Wie lautet das Passwort? " default answer "vpn.bib.de"'); fi
|
||||
#security add-generic-password -a $VPN_USERNAME -s openconnect -w $keychainPW
|
||||
VPN_EXECUTABLE_PARAMS="--servercert $4 --protocol=fortinet" # Optional
|
||||
# VPN connection command, should eventually result in $VPN_CONNECTED,
|
||||
# may need to be modified for VPN clients other than openconnect
|
||||
|
||||
# Verbindung aufbauen
|
||||
echo "echo <pseudeoPW> | sudo $VPN_EXECUTABLE $VPN_EXECUTABLE_PARAMS --user $VPN_USERNAME --passwd-on-stdin $VPN_HOST --pid-file=$OC_PIDFILE --background" > $logfile 2>&1
|
||||
echo "$VPN_PASSWORD" | sudo $VPN_EXECUTABLE $VPN_EXECUTABLE_PARAMS --user $VPN_USERNAME --passwd-on-stdin $VPN_HOST --pid-file=$OC_PIDFILE --background > $logfile 2>&1
|
||||
IP=$(ifconfig | egrep -A1 "$NET_FILTER" |cut -d' ' -f2)
|
||||
|
Loading…
Reference in New Issue
Block a user