Created
February 11, 2020 17:32
-
-
Save jberger/b603c0175a0f0bd3ba3f05fa5e5dbcfc to your computer and use it in GitHub Desktop.
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/bash | |
PID=$(pgrep -f 'ssh -D') | |
CMD=$1 | |
if [[ $CMD == '--stop' ]] | |
then | |
if [[ ! "$PID" ]] | |
then | |
echo 'socks proxy is not running'; | |
exit 1; | |
fi | |
sudo kill $PID; | |
exit 0; | |
fi | |
if [[ $CMD == '--flush' ]] | |
then | |
echo 'flush dns and reload networking'; | |
# flush several times | |
sudo route -n flush; sudo route -n flush; sudo route -n flush; | |
# restart en0 | |
sudo ifconfig en0 down; sudo ifconfig en0 up; | |
exit 0; | |
fi | |
if [[ $PID > 0 ]] | |
then | |
echo 'socks proxy is already running'; | |
exit 1; | |
fi | |
ssh -D 1337 -q -C -N -f sg1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment