I'm using AnyProxy to block websites on my son's computer. I also use it block safe websites like roblox or youtube, just so he can do his home work... Right now i"m seeting up a proxy with some rules and I go and ssh to turn the proxy on and off... I found this last night at 2am and put it on a gitst, but I'll make it public now.
You simply just use the networksetup
command. You can find the params you need to you this way
networksetup -setwebproxy | grep "setproxy"
networksetup -setwebproxy <networkservice> <domain> <port number> <authenticated> <username> <password>
networksetup -setsecurewebproxy <networkservice> <domain> <port number> <authenticated> <username> <password>
Then look up your network services with networksetup -listallnetworkservices
Thank you update...
networksetup -setwebproxy Wi-Fi 127.0.0.1 8001
networksetup -setsecurewebproxy Wi-Fi 127.0.0.1 8001
To turn them off is also super simple
Format
networksetup -setwebproxystate <networkservice> <on off>
networksetup -setsecurewebproxystate <networkservice> <on off>
Example Turn On
networksetup -setwebproxystate Wi-Fi on
networksetup -setsecurewebproxystate Wi-Fi on
Example Turn Off
networksetup -setwebproxystate Wi-Fi off
networksetup -setsecurewebproxystate Wi-Fi off
Format
networksetup -getwebproxy <networkservice>
networksetup -getsecurewebproxy <networkservice>
Example
networksetup -getwebproxy Wi-Fi
networksetup -getsecurewebproxy Wi-Fi