i---------------------------------------- | |
iOSX lynx over tor | |
iNovember 14th, 2017 | |
i---------------------------------------- | |
i | |
iThe fine gentlemen on #freenode's gopher channel were showing off | |
isome of their gopher sites served over tor. I wanted to test it | |
iout while I was at work on my MacBook Air. This machine wasn't | |
iconfigured to use tor at all, so here's the process I went through | |
ito get everything working. (It's really easy) | |
i | |
iStep 1: Install tor and torsocks and lynx if you don't have them | |
i | |
i brew install tor torsocks lynx | |
i | |
iStep 2: Use this wrapper [0] to launch tor and create the proper | |
inetworking configuration to use the socks proxy, and disable that | |
iproxy when you kill tor. | |
i | |
i #!/usr/bin/env bash | |
i | |
i # 'Wi-Fi' or 'Ethernet' or 'Display Ethernet' | |
i INTERFACE=Wi-Fi | |
i | |
i # Ask for the administrator password upfront | |
i sudo -v | |
i | |
i # Keep-alive: update existing `sudo` time stamp until finished | |
i while true; do sudo -n true; sleep 60; kill -0 "$$" || exit; done 2>/dev/ | |
i | |
i # trap ctrl-c and call disable_proxy() | |
i function disable_proxy() { | |
i sudo networksetup -setsocksfirewallproxystate $INTERFACE off | |
i echo "$(tput setaf 64)" #green | |
i echo "SOCKS proxy disabled." | |
i echo "$(tput sgr0)" # color reset | |
i } | |
i trap disable_proxy INT | |
i | |
i # Let's roll | |
i sudo networksetup -setsocksfirewallproxy $INTERFACE 127.0.0.1 9050 off | |
i sudo networksetup -setsocksfirewallproxystate $INTERFACE on | |
i | |
i echo "$(tput setaf 64)" # green | |
i echo "SOCKS proxy 127.0.0.1:9050 enabled." | |
i echo "$(tput setaf 136)" # orange | |
i echo "Starting Tor..." | |
i echo "$(tput sgr0)" # color reset | |
i | |
i tor | |
i | |
iStep 3: Use torify to launch lynx | |
i | |
i torify lynx gopher://hg6vgqziawt5s4dj.onion/1/ | |
i | |
iYour tor service should run fine as-is for browser usage, but it | |
ilooks like you'll need to use torify if you want to launch | |
ia command line app that uses tor. This "just works" for me, so | |
ihopefully it will for you as well. | |
i | |
iNext up, solving this for Linux! | |
i | |
[0] Simple Tor setup on macOS |