Skip to content

Instantly share code, notes, and snippets.

@oakaigh
Last active April 4, 2019 00:04
Show Gist options
  • Save oakaigh/3c250b8c7a114273b9468f119239e819 to your computer and use it in GitHub Desktop.
Save oakaigh/3c250b8c7a114273b9468f119239e819 to your computer and use it in GitHub Desktop.
#!/bin/sh
INTERFACE=$(networksetup -listnetworkserviceorder | awk -F'\\) ' '/\(1\)/ {print $2}')
ADDRESS=localhost; PORT=1080
if networksetup -getsocksfirewallproxy ${INTERFACE} | grep -q "Yes"; then
networksetup -setsocksfirewallproxystate ${INTERFACE} off
osascript -e 'display notification "eLitet JSOCA disconnected" with title "eLitet Service" sound name "default"' ;;
else
networksetup -setsocksfirewallproxy ${INTERFACE} ${ADDRESS} ${PORT} on
osascript -e 'display notification "eLitet JSOCA connected" with title "eLitet Service" sound name "default"' ;;
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment