Skip to content

Instantly share code, notes, and snippets.

@happypeter
Last active July 3, 2016 06:03
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 3 You must be signed in to fork a gist
  • Save happypeter/3444739 to your computer and use it in GitHub Desktop.
Save happypeter/3444739 to your computer and use it in GitHub Desktop.
FUCK GWF apple script
#!/user/bin/env bash
on_die() {
echo
echo byebye proxy
echo
networksetup -setsocksfirewallproxystate "Ethernet 2" off #close the proxy
# the name can be "wifi" or "Ethernet 1", just see what is listed in "network preference"
}
trap "on_die" SIGTERM
trap "on_die" SIGINT
trap "on_die" SIGHUP
networksetup -setsocksfirewallproxy "Ethernet 2" 127.0.0.1 7070 off
sshpass -pvT45kde5Y9r ssh -N -D 7070 aybeeacu@s7.moonssh.com #s1....s9, all available
# ssh -N -D 7070 root@linode_us
# 注意:有时候 linode_us 的 ssh 口如果被墙了,那么这个脚本执行的时候,看起来也是正常的,只不过
# 到浏览器中是不能看墙外的景色的。解决方法就是更换主机 IP
the below to commands equals to click the proxy GUI
# peter:~/bin$ networksetup -setsocksfirewallproxystate "Ethernet 2" off
# peter:~/bin$ networksetup -setsocksfirewallproxystate "Ethernet 2" on
@windy
Copy link

windy commented Oct 27, 2012

Mac Lion networksetup will require you input password every time. Very annoy!

This can help you:

  • Add a line after /etc/suoders:

    username   ALL=NOPASSWD: /usr/sbin/NewNetConfig
    
  • use sudo networksetup but not networksetup

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment