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