I've recently been made aware of an app called Freedom, which basicaly shuts down your Internet connection for a time. This is supposed to enhance your productivity, by keeping you from wasting time on the Internet. That's silly, I thought, why not just exercise some self control? Then I realised I don't have that much self control, so I had a look at the app. It turns out it costs $10, however, which I thought was a bit steep for something I could probably do as a one-liner in bash, so I decided to figure out how it works, or at least how I could do something similar.
At first, I thought about deactivating the network cards, which is pretty trivial from the terminal, at least on the Mac, and I guess it's the same on linux. Just type
Next, I had a look at the terminal firewall, which seems a better choice. By typing
While ipfw seems to be the tool of choice for this job, it won't work very well if you can just switch it off with a command which is actually simpler than the one to switch it on, so I wrote a little python script which will block communication on all ports for a set amount of time. Use it by typing
block.py
At first, I thought perhaps it might be a little rude to write about this, as I guess it could potentially undermine the market for Freedom, which seems to be a one-man operation run in that one man's spare time. However I decided to go ahead anyway when I realised that the kind of people who pay $10 for an app that stops them from going online probably want a graphical interface. Also, according to the webpage, Freedom is used by hundreds of thousands of people (meaning the guy has made millons of dollars), and has been mentioned in a range of newspapers and popular webpages, including the Guardian and the New Yorker, so it seems to be doing quite well.
-Tor Nordam