Last active
September 7, 2021 09:04
-
-
Save dominhhai/949e08598824875c88ed3dae12f8050c to your computer and use it in GitHub Desktop.
MacOSでTorの簡単なインストール方法 ref: https://dominhhai.github.io/vi/2017/01/tor-on-mac/
This file contains 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
# Brewの場合 | |
$ brew install tor | |
# Macportsの場合 | |
$ sudo port install tor |
This file contains 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
$ ./tor.sh |
This file contains 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
#!/usr/bin/env bash | |
# 'Wi-Fi' or 'Ethernet' or 'Display Ethernet' | |
INTERFACE=Wi-Fi | |
# Ask for the administrator password upfront | |
sudo -v | |
# Keep-alive: update existing `sudo` time stamp until finished | |
while true; do sudo -n true; sleep 60; kill -0 "$$" || exit; done 2>/dev/null & | |
# trap ctrl-c and call disable_proxy() | |
function disable_proxy() { | |
sudo networksetup -setsocksfirewallproxystate $INTERFACE off | |
echo "$(tput setaf 64)" #green | |
echo "SOCKS proxy disabled." | |
echo "$(tput sgr0)" # color reset | |
} | |
trap disable_proxy INT | |
# Rollback | |
sudo networksetup -setsocksfirewallproxy $INTERFACE 127.0.0.1 9050 off | |
sudo networksetup -setsocksfirewallproxystate $INTERFACE on | |
echo "$(tput setaf 64)" # green | |
echo "SOCKS proxy 127.0.0.1:9050 enabled." | |
echo "$(tput setaf 136)" # orange | |
echo "Starting Tor..." | |
echo "$(tput sgr0)" # color reset | |
# Start Tor | |
tor |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment