Last active
July 18, 2019 18:46
-
-
Save tjluoma/094f943342bdccb745b988ad5fb6238c to your computer and use it in GitHub Desktop.
Assuming you have a Mac with both wired Ethernet and Wi-Fi, this will show you whether or not the http/https proxy is set for both
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/zsh -f | |
PATH=/usr/local/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin | |
## Note: | |
## ETHERNET_REGULAR / WIFI_REGULAR means http | |
## ETHERNET_SECURE / WIFI_SECURE means https | |
ETHERNET_REGULAR=$(networksetup -getwebproxy Ethernet | awk -F' ' '/^Enabled:/{print $2}') | |
ETHERNET_SECURE=$(networksetup -getsecurewebproxy Ethernet | awk -F' ' '/^Enabled:/{print $2}') | |
WIFI_REGULAR=$(networksetup -getwebproxy Wi-Fi | awk -F' ' '/^Enabled:/{print $2}') | |
WIFI_SECURE=$(networksetup -getsecurewebproxy Wi-Fi | awk -F' ' '/^Enabled:/{print $2}') | |
if [ "$ETHERNET_REGULAR" = "" -a "$ETHERNET_SECURE" = "" ] | |
then | |
# if Ethernet is not found, assume we are on a Mac without wired Ethernet (read: "a MacBook (Air|Pro)") | |
if [ "$WIFI_REGULAR" = "Yes" -a "$WIFI_SECURE" = "Yes" ] | |
then | |
echo "Proxy ON" | |
elif [ "$WIFI_REGULAR" = "No" -a "$WIFI_SECURE" = "No" ] | |
then | |
echo "Proxy OFF" | |
else | |
echo "Proxy Mixed\nWi-Fi http: $WIFI_REGULAR\nWi-Fi https: $WIFI_SECURE" | |
fi | |
else | |
if [ "$ETHERNET_REGULAR" = "Yes" -a "$ETHERNET_SECURE" = "Yes" -a "$WIFI_REGULAR" = "Yes" -a "$WIFI_SECURE" = "Yes" ] | |
then | |
echo "Proxy ON" | |
elif [ "$ETHERNET_REGULAR" = "No" -a "$ETHERNET_SECURE" = "No" -a "$WIFI_REGULAR" = "No" -a "$WIFI_SECURE" = "No" ] | |
then | |
echo "Proxy OFF" | |
else | |
echo "Proxy Mixed\nEthernet http: $ETHERNET_REGULAR\nEthernet https: $ETHERNET_SECURE\nWiFi http: $WIFI_REGULAR\nWifi https: $WIFI_SECURE" | |
fi | |
fi | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment