Skip to content

Instantly share code, notes, and snippets.

@m13253
Created April 10, 2020 03:23
Show Gist options
  • Save m13253/ad1f20dc9ecb39471902c4213fc7e5fe to your computer and use it in GitHub Desktop.
Save m13253/ad1f20dc9ecb39471902c4213fc7e5fe to your computer and use it in GitHub Desktop.
List proxy server status on macOS
#!/usr/bin/env bash
networksetup -listallnetworkservices | tail +2 |
while read NETWORK_SERVICE
do
echo 'Network service: '$'\e[34m'"$NETWORK_SERVICE"$'\e[0m'
networksetup -getproxyautodiscovery "$NETWORK_SERVICE" | sed 's/^/[WPAD] /'
networksetup -getautoproxyurl "$NETWORK_SERVICE" | sed 's/^/[PAC] /'
networksetup -getwebproxy "$NETWORK_SERVICE" | sed 's/^/[HTTP] /'
networksetup -getsecurewebproxy "$NETWORK_SERVICE" | sed 's/^/[HTTPS] /'
networksetup -getftpproxy "$NETWORK_SERVICE" | sed 's/^/[FTP] /'
networksetup -getsocksfirewallproxy "$NETWORK_SERVICE" | sed 's/^/[SOCKS] /'
networksetup -getstreamingproxy "$NETWORK_SERVICE" | sed 's/^/[RTSP] /'
networksetup -getgopherproxy "$NETWORK_SERVICE" | sed 's/^/[Gopher] /'
echo
done |
sed -E 's/(Yes|On)/'$'\e[1;31m''\1'$'\e[0m''/g'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment