Tor Tunnel Convenience on OSX

Occasionally I use the Tor proxy for surfing. Since I don’t want to bog down my local internet connection which often is shared with others, I run a Tor middle node on a virtual server at some ISP. This way I can contribute to the Tor network all the time, even when I am not currently using Tor myself.

For connecting to my Tor node, I set up some small scripts to do all the plumbing for me. Simply fire up my tortunnel, and I’m ready to go. Switching Proxies on OSX is buried deep in a second level menu item in the network settings. I am using two little scripts to have the proxy switched on and off automatically.

#!/bin/bash
HOST=`host my.virtualserver.tld|awk '{print $4}'`
pon
sudo ssh -p24 username@$HOST  -L localhost:8123:$HOST:8123 \
 -L  localhost:53:$HOST:53 -t 'tmux -c "/usr/local/bin/arm/arm"'
pof

Since I also redirect my DNS lookups I have to fetch the hostname of my own server before I switch on the proxy. I have dnsmasq running on my server. This allows me to filter some bogus name resolutions. Sure, the DNS lookups can be traced back to my server. Maybe I will funnel them tru Tor later.

The arm Script on my server shows nifty graphs and info about the health of my Tor node.

pon and pof are simple shellscripts which use the OSX networksetup tool to operate the proxy settings:

#!/bin/bash
networksetup -setsecurewebproxystate Ethernet on
networksetup -setwebproxystate Ethernet on
networksetup -setsecurewebproxystate Airport on
networksetup -setwebproxystate Airport on
networksetup -setdnsservers Ethernet 127.0.0.1
echo "proxy is on"
#!/bin/bash
networksetup -setsecurewebproxystate Ethernet off
networksetup -setwebproxystate Ethernet off
networksetup -setsecurewebproxystate Airport off
networksetup -setwebproxystate Airport off
etworksetup -setdnsservers Ethernet empty
echo "proxy is off"

I use Safari for my Tor surfing since Safari uses the system wide proxy settings. Firefox uses its own settings. This way I can torsurf in parallel to normal surfing. Of course there are some proxy switching plugins for Firefox I could use, but since I usually keep a lot of tabs open and do my main surfing on FF I decided to use Safari as my anonymous Browser.

Private browsing can not be automatically be turned on per default in Safari, thus I am using a little Script to activate Safari and set it to private mode:

tell application "Safari"
	activate
end tell

tell application "System Events"
	tell process "Safari"
		tell menu bar 1
			tell menu bar item "Safari"
				tell menu "Safari"
					click menu item "Private Browsing"
				end tell
			end tell
		end tell
	end tell
end tell

If you are using a different system language, you will have to adjust the “Private Browsing” term into the approriate locale. Simply check the Safari menu.

The start page of Safari is set to the Tor Check website to see whether I am really using the Tor network.

flattr this!

30. Januar 12 in Code

Edit Pdf Metadata

For my ‘Project Paperless’ I recently purchased the highly recommended Fujitsu ScanSnap 1500M, which comes bundled with a functionally limited edition of Abby Finereader. The Finereader software receives the scanned document and runs a surprisingly high quality OCR on it, resulting in a Pdf which shows the scanned paper in the background, but additionally has selectable text above that. The output Pdf has picture and text and is therefore indexable by Spotlight. Sweet.

There are two problems with this setup:

  1. Title, Author and Creator metadata is not editable
  2. Scans from other sources are refused by Finereader.

mehr »

flattr this!

25. Januar 11 in Code, Productivity

Mein schnörkelloser bash Prompt

Es gibt im Netz tausende Beispiele für fancy bash prompts. Ich mag meinen Prompt schnörkellos und effizient. Ich möchte wissen, auf welcher Maschine ich bin, ich möchte gerne wissen wo ich bin, aber ich möchte auch noch Platz zum Tippen haben und nicht nur lange Pfade sehen.
Deshalb lasse ich mir die letzten beiden Verzeichnisse anzeigen. An denen lässt sich in der Regel sehr gut ablesen, wo man gerade herumdümpelt.

In der .bashrc fügt man dafür folgendes ein:

function PWD {
tmp=${PWD%/*/*};
[ ${#tmp} -gt 0 -a "$tmp" != "$PWD" ] && echo ${PWD:${#tmp}+1} || echo $PWD;
}


export PS1="\h:\$(PWD 3)>";

Voilá!

flattr this!

11. Februar 10 in Code
Navigation
Netlabel
Nachhaltigkeit
Fonts
Soundtrack
Mixtape von Jahtari Artist Mallem (aka Dub-4)