Created
May 23, 2019 11:03
-
-
Save ruggertech/fcd93f11d6ce16abbc76e90adcc392a2 to your computer and use it in GitHub Desktop.
turn free proxy on, using mac command line
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
SERVICE="Thunderbolt Ethernet Slot 1" # or "Wi-Fi" | |
echo $PROXYHOST | |
while [[ $# > 0 ]] | |
do | |
case "$1" in | |
on) | |
PROXYHOST="$(curl "http://pubproxy.com/api/proxy?limit=1&format=txt&type=socks5&https=true&google=true")" | |
PROXY_HOST=${PROXYHOST%%:*} | |
PROXY_PORT=${PROXYHOST##*:} | |
echo $PROXY_HOST | |
echo $PROXY_PORT | |
networksetup -setwebproxystate "$SERVICE" on | |
networksetup -setwebproxy "$SERVICE" $PROXY_HOST $PROXY_PORT off | |
networksetup -setsecurewebproxystate "$SERVICE" on | |
networksetup -setsecurewebproxy "$SERVICE" $PROXY_HOST $PROXY_PORT off | |
echo 'Web proxy is on' | |
shift | |
;; | |
off) | |
networksetup -setwebproxystate "$SERVICE" off | |
networksetup -setsecurewebproxystate "$SERVICE" off | |
echo 'Web proxy is off' | |
shift | |
;; | |
esac | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment