A simple cross-browser technique to block potentially harmful websites
Monday, March 27, 2006 1:11:53 PM
The technique outlined below uses a keyword-based proxy automatic configuration (PAC) script that can be setup in virtually any web browser to block potentially harmful websites, such as porn-related sites.
STEPS:
1. First, download the blockPorn.pac file (right-click on link, select Save target as...) to a location on your local hard disk that is accessible to everyone -- I suggest the root folder of drive C:\
2. Then, depending upon the web browser you are configuring, assign the location of the blockPorn.pac file, ensuring to prepend the file:// protocol before the location of the blockPorn.pac file (see below)...
Internet Explorer:
2a) Open Internet Explorer
2b) Pull-down Tools menu
2c) Select Internet Options
2d) Goto Connections tab
2e) Press the LAN Settings button
2f) Check on the Use automatic configuration script checkbox
2g) Type-in file:// then the location of the blockPorn.pac file.
For example: file://C:\blockPorn.pac
2h) Press OK twice to close both dialogs.

Firefox:
2a) Open Firefox
2b) Type about:config in the address bar, then press [Enter]
2c) Type the word autoconfig in the Filter bar
2d) Double-click the network.proxy.autoconfig_url setting to edit it
2e) Type-in file:///, then the location of the blockPorn.pac file -- using all forward-slashes.
For example: file:///c:/blockPorn.pac

Opera:
2a) Open Opera
2b) Pull-down Tools menu
2c) Select Preferences
2d) Goto Advanced tab
2e) Goto Network section
2f) Click Proxy servers button
2g) Check on the Use automatic proxy configuration checkbox
2h) Type-in file://, then localhost, then the location of the blockPorn.pac file -- using all forward-slashes.
For example: file://localhost/C:/blockPorn.pac
2i) Press OK twice to close both dialogs.

If you stumble on false-positive websites that the blockPorn.pac script blocks, but you'd like to allow them, then you can simply edit the blockPorn.pac file and either remove the offending keyword which is blocking the website, or you can add the websites to the aAllowedDomains array located at the top of the file. If you choose the later, just be sure to enclose the website domain in quotes ("), and append a comma (,) after the entry. For example:
Unfortunately, the blocking technique outlined above isn't fool-proof. For example, any legitimate website can host porn-related material. As it stands, the current blockPorn.pac script above does not block such material from legit websites.
As another free alternative, Proxomitron is an excellent personal web proxy. If you do use Proxomitron, I recommend downloading/installing JD 5000's rules. The blockPorn.pac script outlined above can be used in conjunction with Proxomitron. To do so, change all "DIRECT" references at the bottom of the script to be "127.0.0.1:8080; DIRECT". For example,
For more complete coverage, I recommend purchasing a commercial off-the-shelf product, such as NetNanny, since it also checks content ratings, page contents, complete URLs, and other criteria.
References:
http://wp.netscape.com/eng/mozilla/2.0/relnotes/demo/proxy-live.html
http://www.microsoft.com/technet/prodtechnol/ie/reskit/6/part6/c26ie6rk.mspx
http://java.sun.com/j2se/1.4.2/docs/guide/plugin/developer_guide/proxie_config.html
http://www.microsoft.com/technet/prodtechnol/ie/ieak/techinfo/deploy/60/en/corpexjs.mspx
http://nscsysop.hypermart.net/proxypac.html
Enjoy.
STEPS:
1. First, download the blockPorn.pac file (right-click on link, select Save target as...) to a location on your local hard disk that is accessible to everyone -- I suggest the root folder of drive C:\
2. Then, depending upon the web browser you are configuring, assign the location of the blockPorn.pac file, ensuring to prepend the file:// protocol before the location of the blockPorn.pac file (see below)...
Internet Explorer:
2a) Open Internet Explorer
2b) Pull-down Tools menu
2c) Select Internet Options
2d) Goto Connections tab
2e) Press the LAN Settings button
2f) Check on the Use automatic configuration script checkbox
2g) Type-in file:// then the location of the blockPorn.pac file.
For example: file://C:\blockPorn.pac
2h) Press OK twice to close both dialogs.

Firefox:
2a) Open Firefox
2b) Type about:config in the address bar, then press [Enter]
2c) Type the word autoconfig in the Filter bar
2d) Double-click the network.proxy.autoconfig_url setting to edit it
2e) Type-in file:///, then the location of the blockPorn.pac file -- using all forward-slashes.
For example: file:///c:/blockPorn.pac

Opera:
2a) Open Opera
2b) Pull-down Tools menu
2c) Select Preferences
2d) Goto Advanced tab
2e) Goto Network section
2f) Click Proxy servers button
2g) Check on the Use automatic proxy configuration checkbox
2h) Type-in file://, then localhost, then the location of the blockPorn.pac file -- using all forward-slashes.
For example: file://localhost/C:/blockPorn.pac
2i) Press OK twice to close both dialogs.

If you stumble on false-positive websites that the blockPorn.pac script blocks, but you'd like to allow them, then you can simply edit the blockPorn.pac file and either remove the offending keyword which is blocking the website, or you can add the websites to the aAllowedDomains array located at the top of the file. If you choose the later, just be sure to enclose the website domain in quotes ("), and append a comma (,) after the entry. For example:
var aAllowedDomains = ["barbie.everythinggirl.com", ".disney.com", "groups.google.com", ".hotwheels.com"];
Unfortunately, the blocking technique outlined above isn't fool-proof. For example, any legitimate website can host porn-related material. As it stands, the current blockPorn.pac script above does not block such material from legit websites.
As another free alternative, Proxomitron is an excellent personal web proxy. If you do use Proxomitron, I recommend downloading/installing JD 5000's rules. The blockPorn.pac script outlined above can be used in conjunction with Proxomitron. To do so, change all "DIRECT" references at the bottom of the script to be "127.0.0.1:8080; DIRECT". For example,
function FindProxyForURL(url, host) {
var hostLC = host.toLowerCase();
for (var i = 0, allowedDomain; allowedDomain = aAllowedDomains[ i ]; i++) {
if (hostLC.indexOf(allowedDomain) >= 0) return "127.0.0.1:8080; DIRECT";
}
for (var i = 0, blockWord; blockWord = aBlockWords[ i ]; i++) {
if (hostLC.indexOf(blockWord) >= 0) return "PROXY 0.0.0.0:80";
}
return "127.0.0.1:8080; DIRECT";
}
For more complete coverage, I recommend purchasing a commercial off-the-shelf product, such as NetNanny, since it also checks content ratings, page contents, complete URLs, and other criteria.
References:
http://wp.netscape.com/eng/mozilla/2.0/relnotes/demo/proxy-live.html
http://www.microsoft.com/technet/prodtechnol/ie/reskit/6/part6/c26ie6rk.mspx
http://java.sun.com/j2se/1.4.2/docs/guide/plugin/developer_guide/proxie_config.html
http://www.microsoft.com/technet/prodtechnol/ie/ieak/techinfo/deploy/60/en/corpexjs.mspx
http://nscsysop.hypermart.net/proxypac.html
Enjoy.
