-
Notifications
You must be signed in to change notification settings - Fork 15
Expand file tree
/
Copy pathpsproxy.sh
More file actions
executable file
·54 lines (43 loc) · 1.24 KB
/
psproxy.sh
File metadata and controls
executable file
·54 lines (43 loc) · 1.24 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#!/usr/bin/env bash
# Toggle the proxy settings for Junos Pulse Secure
# ./psproxy.sh on # To toggle proxy settings on
# ./psproxy.sh off # To toggle proxy settings off
#
# Taken from https://gist.github.com/mivasi/bc0046aa2277a64726c8
pulseSecureState=`scutil << EOF
show State:/Network/Service/net.pulsesecure.pulse.nc.main/IPv4
quit
EOF`
GR='\033[0;32m'
YL='\033[1;33m'
NC='\033[0m' # No Color
serviceKey=`echo $pulseSecureState | sed -n "s/.*DSUnderlyingServiceName : \([^']*\) }.*/\1/p"`
if [ $1 == "on" ]; then
echo
echo "Enabling proxy settings..."
results=`scutil<< EOF
d.init
get Setup:/Network/Service/${serviceKey}/Proxies
set State:/Network/Service/net.pulsesecure.pulse.nc.main/Proxies
quit
EOF`
echo "${GR}Done!${NC}"
elif [ $1 == "off" ]; then
echo
echo "Disabling proxy settings..."
results=`scutil<< EOF
d.init
get State:/Network/Service/net.pulsesecure.pulse.nc.main/Proxies
d.add HTTPSEnable 0
d.add HTTPEnable 0
set State:/Network/Service/net.pulsesecure.pulse.nc.main/Proxies
quit
EOF`
echo "${GR}Done!${NC}"
else
echo
echo "Execute ${YL}'sudo psproxy on'${NC} to enable the proxy settings"
echo "Execute ${YL}'sudo psproxy off'${NC} to disable the proxy settings"
exit
fi
echo $results;