Open-Block is a project mainly written in Python, it's free.
Editing host file to connect web sites directly.
Open block is a simple python script to find domains IP and edit /etc/hosts automaticly in Ubuntu.
sudo python openblock.py domainname.om