views:

32

answers:

2

I need to be able to block the urls that are stored in a text file on the hard disk using Python. If the url the user tries to visit is in the file, it redirects them to another page instead. How is this done?

+3  A: 

There are several proxies written in Python: you can pick one of them and modify it so that it proxies most URLs normally but redirects those in your text file. You'll also need to set IE to use that proxy, of course.

Alex Martelli
+1  A: 

Doing this at the machine level is a weak solution, it would be pretty easy for a technically inclined user to bypass.

Even with a server side proxy it will be very easy to bypass unless you firewall normal http traffic, at a bare minimum block ports 80, 443.

You could program a proxy in python as Alex suggested, but this is a pretty common problem and there are plenty of off the shelf solutions.

That being said, I think that restricting web access will do nothing but aggravate your users.

mikerobi