This is how it would look using a whitelist ...
127.0.0.1 localhost
87.106.181.57 www.autoitscript.com # allowed
127.0.0.1 dirty.rotten.websites.com # denied
Blacklisting would send it to the localhost -- and whitelisting would send it to the correct ip.
The hosts file is good for blacklisting, but not so good otherwise.
Here's another alternative --
You would be much better off, using a local proxy server.
A small proxy server would see if the site is in the whitelist and allow all ip addresses
associated with it to pass. I think something like this could be made with less than
150 lines of code -And- with no additional hardware. The program would reside
on the users computer.
I have not searched the forum for local proxy servers, but,
maybe a member already has one in the examples forum.
Basically it would work something like this:
Browser --> Local Proxy Server (Check WhiteList) --> Send response to Browser
The LPS would be responsible for retrieving website data and send it back to the browser.
There are several advantages to this method -- since the LPS handles the incoming data.
I don't know what your situation is -- maybe, if you could be a little more forth-coming,
there might be other ways of accomplishing what you want.