You are not logged in.

#1 2010-01-19 14:24:55

stabele
Member
Registered: 2008-12-22
Posts: 101

how to temporary block list of web pages?

Hi While working I need access to web pages (I am developing web applications) but same time often I got distracted and spend my time reading interesting articles on web instead doing my job. I was using LeechBlock addon for Firefox, but now I migrated to chrome. So my question is:

Is there simple way how to temporary block list of web pages for all browsers?

It is OK to block http/https access only, but no problem to block all traffic from/to this sites. I need to by able to easily start/stop this block.

Offline

#2 2010-01-19 14:27:19

Ramses de Norre
Member
From: Leuven - Belgium
Registered: 2007-03-27
Posts: 1,289

Re: how to temporary block list of web pages?

Aliasing the hostnames to localhost (or something else) in /etc/hosts will redirect everything to your local machine (or somewhere else). You could write a script to add and remove a list of sites which you store in a file somewhere.

Offline

#3 2010-01-19 14:35:56

stabele
Member
Registered: 2008-12-22
Posts: 101

Re: how to temporary block list of web pages?

I see two problems with this approach:
1) I need to be able to block/unblock withou restarting browser.
2) I need to be able to use wildcards like *bbc.co.uk, which is not possible in /etc/hosts (or am I wrong?)

Offline

#4 2010-01-19 16:05:53

anonymous_user
Member
Registered: 2009-08-28
Posts: 3,059

Re: how to temporary block list of web pages?

Offline

#5 2010-01-19 17:36:27

stabele
Member
Registered: 2008-12-22
Posts: 101

Re: how to temporary block list of web pages?

Thankks for tip. It miss key option - to easily switch blocking on/off. But yes, it is 80% solution.

Offline

#6 2010-01-20 14:54:21

cookiecaper
Member
Registered: 2007-09-22
Posts: 198

Re: how to temporary block list of web pages?

You shouldn't have to restart your browser after adding /etc/hosts.

If you redirect a parent domain like bbc.co.uk, I think all subdomains would get redirected too, but I'm not sure I guess.

Offline

#7 2010-01-20 22:25:19

chlg
Member
Registered: 2010-01-13
Posts: 10

Re: how to temporary block list of web pages?

No. Each domain has (or has not) its own IP address. The IP address of a parent domain has no influence on the IP address of subdomains.

If you want to be able to use willcard, the best way is probably to base the filtering on HTTP level traffic.
That is directly in the client (firefox/chrome extensions)
Or, using an http proxy (squid).
Or, may be, using iptables with rules that match the URL.

eg
sudo iptables -A OUTPUT -p tcp --dport 80 -m string --string "google.com" --algo kmp -j DROP
will block outgoing traffic matching "google.com". You can of course tune better rules.

sudo iptables -F OUTPUT will flush all rules.

You can then add many "iptables -A OUTPUT" lines in a script, and associate a key shortcut to this script...

Well, an extension to the browser is probably preferable. I give this solution only for the fun big_smile

Offline

Board footer

Powered by FluxBB