Skip to content

Commit

Permalink
( ꒪⌓꒪) Add socks-proxy command to change sock-proxy setting from co…
Browse files Browse the repository at this point in the history
…mmand line

                   _
                  / jjjj      _
                / タ       {!!! _ ヽ、
               ,/  ノ        ~ `、  \        _
               `、  `ヽ.  ∧_∧ , ‐'`  ノ      /  `j
     ∧_∧_      \  `ヽ(´・ω・`)" .ノ/    /  /`ー'
    (´・ω・`)  ̄"⌒ヽ    `、ヽ.  ``Y"   r '     〈  `ヽ
   / ) ヽ' /    、 `、   i. 、   ¥   ノ       `、  ヽ∧_∧
  γ  --‐ '      λ. ;   `、` -‐´;`ー.イ         〉    ´・ω)    ,-、、
  f   、   ヾ    /   )    i 彡 i ミ/         / ノ    ̄⌒ヽ   「  〉
  !  ノヽ、._, '`"/  _,. '"     }    {         ノ  ' L     `ヽ./  /
  |   ̄`ー-`ヽ 〈  < _ ヽ.    /     `\      / , '    ノ\  ´  /
   !、__,,,  l ,\_,ソ ノ   /   /ヽ、  ヽ.     (     ∠_   ヽ、_, '
       〈'_,/ /   /   /  ノ    ヽ.   )     i  、      ヽ
    socks-proxy          Wi-Fi                                      on
  • Loading branch information
yuroyoro committed Aug 20, 2013
1 parent 39f2172 commit e0b06d0
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions bin/socks-proxy
@@ -0,0 +1,31 @@
#!/bin/sh

# usage :
# socks-proxy [NETWORK] [on|off] [PROXY] [PORT]
# socks-proxy Wi-Fi on localhost 1080
#
# SOCKSプロキシを使った接続とその設定 - 帽子の中 http://d.hatena.ne.jp/seaborgium/20111227/1324993156

NETWORK=$1
SWITCH=$2
PROXY=$3
PORT=$4

if [ -z "${NETWORK}" ]; then
NETWORK="Ethernet"
fi
if [ -z "${SWITCH}" ]; then
SEITCH="on"
fi

if [ -n "${PROXY}" -a -n "${PORT}" ]; then
networksetup -setsocksfirewallproxy ${NETWORK} ${PROXY} ${PORT}
echo "Network [${NETWORK}] : set socks proxy to '${PROXY}:${PORT}'"
fi

networksetup -setsocksfirewallproxystate ${NETWORK} ${SWITCH}
if [ ${SWITCH} = "on" ]; then
echo "Network [${NETWORK}] : socks proxy is enabled"
else
echo "Network [${NETWORK}] : socks proxy is disabled"
fi

0 comments on commit e0b06d0

Please sign in to comment.