Small apps like Freedom and Anti-social have created quite a stir lately. They cut you off from the internet either entirely or just block social networking sites in order to discourage procrastination and help you exert self control when you really want to get some work done.
I looked at the available options and also at some Google Chrome extensions and decided that none of them is exactly doing what I want, so I'm planning to write my own little Python tool to do that. My first impulse was to simply modify /etc/hosts
to re-route requests to certain servers back to localhost
. However, this can only block entire domains. I'd need to block addresses based on regular expressions or simple string matching to block something like google.com/reader
(yes, this one in particular), but not the entire google.com
domain.
Which Python framework can I use to monitor my network traffic and block blacklisted addresses and what is the basic design to achieve what I want to do? Do I use the socket
library? I'm very comfortable with Python, but I'm very new to network programming.