On-Demand Routing network traffic via Tor

I have recently started using Tor Proxy for my browsing needs.   However, there are times where the latency delay seem to test my patience and I end up giving more weight to my browsing experience than the anonymity needs, especially when am trying to search for my work related needs.

But switching Off the Tor Proxy in my browser seemed quite a painful task…hence this script(courtesy: kremalicious.com) but have made minor tweaks for my needs…

!/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 &

# Let's roll

echo 'Switching to Tor Proxy...'
sudo networksetup -setsocksfirewallproxy $INTERFACE 127.0.0.1 9050 off
sudo networksetup -setsocksfirewallproxystate $INTERFACE on

echo 'Starting Tor...'
tor
sudo networksetup -setsocksfirewallproxystate $INTERFACE off

You can confirm if you are using Tor or not by going to this URL in your browser : check.torproject.org

Run this command in your terminal and your Mac’s network interface would switch to use Tor Proxy.  Simply terminate the command to switch back to not using Tor.

Advertisements
This entry was posted in Uncategorized. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s