Block a web site

#1
I use the latest version of FireFox, and have installed add-ons to block un-desirable content from the Internet. The add-ons Adblock Plus, Flashblock, Ghostery, and ProCon Latte do a great job of blocking un-desirable content from the Internet.

Microsoft Security Essentials provides great protection from viruses and such, and having un-desirable sites blocked in the hosts file is another part of securing my XP system.

I also keep my hosts file up-to-date with the latest threats via the MVPS Hosts updates. Using HostsMan allows me to update my hosts file, without losing sites that I have manually added to my hosts file.

With all of this security, there are still un-desirable sites that do get through

A FireFox addon, ShowIP, displays the IP address of the site that is being viewed in FireFox. Left clicking on this IP address pops up a menu, showing the host for the site being viewed. Directly underneath it is the option to copy this host to the clipboard.

To block this site for my system, regardless of what browser, program, or CLI I am using, I add the site to my hosts file. The following is a batch file that I have written to do this.

Code:
::
:: Add a host name to the hosts file,
::  in order to block that host.
::
:: Written using
:: TCC  11.00.52   Windows XP [Version 5.1.2600]
:: TCC Build 52   Windows XP Build 2600  Service Pack 3
::
:: Joe Caverly, January 2001
::
@echo off
set hosts=C:\WINDOWS\system32\drivers\etc\hosts
echo Searching %hosts file for %@clip[0]
ffind /t"%@clip[0]" %hosts > nul
if %_? eq 2 goto notfound
echo %@clip[0] already exists in hosts
goto eoj
:notfound
::Ensure that this is a good IP Name
if %@count[.,%@clip[0]] eq 0 goto badname
if %@ipaddress[%@clip[0]] eq 11001 goto badname
::
:: You may need to add further checking,
::  depending on how you use your hosts file.
::
echo Adding %@clip[0] to hosts file
echo 127.0.0.1  %@clip[0] >> C:\WINDOWS\system32\drivers\etc\hosts
echo %@clip[0] is now blocked
goto eoj
:badname
echo (%@clip[0]) is a bad IP Name
:eoj
I have also added a button to the Take Command Toolbar, that I can click after switching from FireFox, that will execute the batch file, with the command c:\utils\a2h.btm enter

As I still use XP, the location of your hosts file may be different if you use Vista or Windows 7.

While there may be other solutions, this is a quick way to add the name of a host to your hosts file, so that it is immediately blocked on your system. If, in the future, you want to unblock this site, simply edit your hosts file, and remove the line from the file, or precede the line with a #.

Joe
 

samintz

Scott Mintz
May 20, 2008
1,271
11
Solon, OH, USA
#2
Joe,

You may be interested in checking out
ClearCloud from Sunbelt Software (I think they may be called GFI now) the
makers of the most awesome-est antivirus/antispyware/firewall product
Vipre Premium. http://www.vipreantivirus.com

ClearCloud is a free service. http://clearclouddns.com

-Scott

Joe Caverly <> wrote
on 01/19/2011 10:55:58 AM:


> Joe Caverly <>
> 01/19/2011 10:55 AM
>
> Please respond to
>
>
> To
>
> [email protected]
>
> cc
>
> Subject
>
> [T&T - Scripting-t-2539] Block a web site
>
> I use the latest version of FireFox, and have installed add-ons to

> block un-desirable content from the Internet. The add-ons Adblock

> Plus, Flashblock, Ghostery, and ProCon Latte do a great job of
> blocking un-desirable content from the Internet.
>
> Microsoft Security Essentials provides great protection from viruses
> and such, and having un-desirable sites blocked in the hosts file
is

> another part of securing my XP system.
>
> I also keep my hosts file up-to-date with the latest threats via the
> MVPS Hosts updates http://www.mvps.org/winhelp2002/hosts.htm

allows me to

> update my hosts file, without losing sites that I have manually
> added to my hosts file.
>
> With all of this security, there are still un-desirable sites that

> do get through
>
> A FireFox addon, ShowIP, displays the IP address of the site that
is

> being viewed in FireFox. Left clicking on this IP address pops up
a

> menu, showing the host for the site being viewed. Directly
> underneath it is the option to copy this host to the clipboard.
>
> To block this site for my system, regardless of what browser,
> program, or CLI I am using, I add the site to my hosts file. The
> following is a batch file that I have written to do this.
>
>
> Code:
> ---------
> ::
> :: Add a host name to the hosts file,
> :: in order to block that host.
> ::
> :: Written using
> :: TCC 11.00.52 Windows XP [Version 5.1.2600]
> :: TCC Build 52 Windows XP Build 2600 Service Pack 3
> ::
> :: Joe Caverly, January 2001
> ::
> @echo off
> set hosts=C:\WINDOWS\system32\drivers\etc\hosts
> echo Searching %hosts file for %@clip[0]
> ffind /t"%@clip[0]" %hosts > nul
> if %_? eq 2 goto notfound
> echo %@clip[0] already exists in hosts
> goto eoj
> :notfound
> ::Ensure that this is a good IP Name
> if %@count[.,%@clip[0]] eq 0 goto badname
> if %@ipaddress[%@clip[0]] eq 11001 goto badname
> ::
> :: You may need to add further checking,
> :: depending on how you use your hosts file.
> ::
> echo Adding %@clip[0] to hosts file
> echo 127.0.0.1 %@clip[0] >> C:\WINDOWS\system32\drivers\etc\hosts
> echo %@clip[0] is now blocked
> goto eoj
> :badname
> echo (%@clip[0]) is a bad IP Name
> :eoj
> ---------
> I have also added a button to the Take Command Toolbar, that I can

> click after switching from FireFox, that will execute the batch
> file, with the command c:\utils\a2h.btm enter
>
> As I still use XP, the location of your hosts file may be different

> if you use Vista or Windows 7.
>
> While there may be other solutions, this is a quick way to add the

> name of a host to your hosts file, so that it is immediately blocked
> on your system. If, in the future, you want to unblock this site,

> simply edit your hosts file, and remove the line from the file, or

> precede the line with a #.
>
> Joe
>
>
>
>
 
#3
Thankyou, but when I say un-desirable websites, I mean pornographic.

A Firefox add-on like ProCon Latte does block sites with its blocked words and blocked sites lists, but I consider pictures of scantly clad females to be pornographic, while others do not.

While adding the sites I want blocked to the ProCon Latte blocked sites list does block them in Firefox, it does not block them in Internet Explorer, or other applications that access the Internet. Blocking the sites via the hosts file is a better solution, and it does not consume any memory or resources on the system.

Anti-Virus software will not block this "soft porn".

Joe