Toggle Socks proxy state in safari using Apple script
set socksStatus to do shell script "networksetup -getsocksfirewallproxy Wi-fi | grep Enabled"
if (offset of "Yes" in socksStatus) = 0 then
do shell script "networksetup -setsocksfirewallproxystate Wi-fi On"
display notification "Status: Socks Enabled" & socksStatus
else
do shell script "networksetup -setsocksfirewallproxystate Wi-fi Off"
display notification "Status: Socks disabled" & socksStatus
end if