Page 1 of 2

How to block ads, banners, 3rd party cookies, page counters, web bugs and hijackers

Posted: Sat Oct 21, 2017 9:13 pm
by catweazel
Your hosts file sits in /etc/hosts and probably looks like this:

Code: Select all

127.0.0.1       localhost
127.0.1.1       Fenella

# The following lines are desirable for IPv6 capable hosts
::1     ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
Give it a huge upgrade to stop web-nasties by opening this link and copy everything from this line onwards:

Code: Select all

# [Start of entries generated by MVPS HOSTS]
In a terminal, sudo nano -w /etc/hosts and paste the text at the end of the file.

ctrl-o, enter to save, then ctrl-x to exit.

All done.

The file is updated regularly so if web security is important to you, check the link every month for updates.

If you'd like to know more, see this link. It's Windwoes oriented but it'll give you a good idea of what's going on.

Edit: To automate the download process and the update of the hosts file, see this link. Thanks to user majpooper for the tip.

Re: How to block block ads, banners, 3rd party cookies, page counters, web bugs and hijackers

Posted: Sat Oct 21, 2017 10:40 pm
by sammiev
Thanks testing it now.

Re: How to block block ads, banners, 3rd party cookies, page counters, web bugs and hijackers

Posted: Sun Oct 22, 2017 5:20 pm
by Resistor
Thanks, catweazel.

I've often wondered how it worked in Linux.
Do we need to do anything with the other Host files?

Re: How to block block ads, banners, 3rd party cookies, page counters, web bugs and hijackers

Posted: Mon Oct 23, 2017 12:57 am
by catweazel
Resistor wrote:Do we need to do anything with the other Host files?
No.

Re: How to block block ads, banners, 3rd party cookies, page counters, web bugs and hijackers

Posted: Mon Oct 23, 2017 1:03 am
by Pierre
these type of Host File Lists are useful, but you do need to constantly update them . .

other folks just use a browser add-on like No Script to do the job.
& there is nothing wrong with the "belt & braces" approach, either.
8)

Re: How to block block ads, banners, 3rd party cookies, page counters, web bugs and hijackers

Posted: Mon Oct 23, 2017 1:03 am
by Resistor
I appreciate the insight, catweazel.
I know more now, than I did on Saturday... :mrgreen:

Re: How to block block ads, banners, 3rd party cookies, page counters, web bugs and hijackers

Posted: Mon Oct 23, 2017 1:07 am
by Resistor
Pierre wrote:these type of Host File Lists are useful, but you do need to constantly update them . .

other folks just use a browser add-on like No Script to do the job.
& there is nothing wrong with the "belt & braces" approach, either.
8)
That be me... belt & braces.
I'm glad to no longer be running with a largely useless hosts file.
It has been a long time...

Re: How to block block ads, banners, 3rd party cookies, page counters, web bugs and hijackers

Posted: Mon Oct 23, 2017 4:47 am
by Aleron Ives
Manually pasting this into your hosts file every month seems rather inelegant, but I guess it is the most straightforward and cross-platform-friendly solution if MVPs doesn't want to ask people to run extra peerblocking software.

Re: How to block block ads, banners, 3rd party cookies, page counters, web bugs and hijackers

Posted: Mon Oct 23, 2017 4:55 am
by catweazel
Aleron Ives wrote:Manually pasting this into your hosts file every month seems rather inelegant
catweazel wrote:To automate the download process and the update of the hosts file, see this link.

Re: How to block block ads, banners, 3rd party cookies, page counters, web bugs and hijackers

Posted: Mon Oct 23, 2017 5:00 am
by Aleron Ives
I guess I should have chosen my words more carefully. Using your hosts file for this purpose seems rather inelegant. :wink:

Re: How to block block ads, banners, 3rd party cookies, page counters, web bugs and hijackers

Posted: Mon Oct 23, 2017 5:14 am
by catweazel
Aleron Ives wrote:Using your hosts file for this purpose seems rather inelegant. :wink:
<shrug>

Re: How to block block ads, banners, 3rd party cookies, page counters, web bugs and hijackers

Posted: Mon Oct 23, 2017 6:21 am
by Moem
I don't see what's inelegant about it. If you already know you aren't interested in a certain portion of what the internet offers, why not simply deny it entry to your computer?

Re: How to block block ads, banners, 3rd party cookies, page counters, web bugs and hijackers

Posted: Mon Oct 23, 2017 7:03 am
by Aleron Ives
I was under the impression that the hosts file was intended for addresses that DNS can't resolve, e.g. the hostnames of the machines on your LAN, so you can access them easily. This seems like a task best suited to browser-based blocking software, where you could use features such as analytics to see which filters are being used frequently and to prune filters that have no hits to speed up the process of checking the blocklist on each page you visit. I'm not really sure how you would expect these entities to be accessing your PC other than through a browser, so globally blocking them in a manner that gives no feedback as to the efficacy of each filter seems a bit heavy handed an inefficient IMHO. Am I missing some added benefit of doing it this way?

Re: How to block block ads, banners, 3rd party cookies, page counters, web bugs and hijackers

Posted: Mon Oct 23, 2017 8:15 am
by Moem
It's easy. Set it and forget it. I can see why you'd call it 'heavy handed', but 'inefficient'... no. It works very well and there is very little effort, how can it be inefficient?

Re: How to block block ads, banners, 3rd party cookies, page counters, web bugs and hijackers

Posted: Mon Oct 23, 2017 2:20 pm
by Flemur
I used to use the 'hosts' file but it doesn't support wild-cards; 'privoxy' is a lot easier once you get it set up.

Re: How to block block ads, banners, 3rd party cookies, page counters, web bugs and hijackers

Posted: Mon Oct 23, 2017 8:22 pm
by syg00
Very last century. I park a pi3 as a getway/router so the entire house can be protected without having to constantly update each machine individually.

Each to their own.

Re: How to block block ads, banners, 3rd party cookies, page counters, web bugs and hijackers

Posted: Mon Oct 23, 2017 9:16 pm
by majpooper
A very simple script and a cron and you are done - what's the big deal?

Re: How to block block ads, banners, 3rd party cookies, page counters, web bugs and hijackers

Posted: Mon Oct 23, 2017 9:33 pm
by sammiev
I did setup a script and cron job to run each day but you can also setup to receive an email when a update to the hosts file is updated.

Then run the script as required than each day. It seems last update was mid Sept.

Just saying.

http://winhelp2002.mvps.org/updates.htm

Re: How to block block ads, banners, 3rd party cookies, page counters, web bugs and hijackers

Posted: Tue Oct 24, 2017 1:41 am
by catweazel
Aleron Ives wrote:I was under the impression that the hosts file was intended for addresses that DNS can't resolve
Clearly it's also intended for addresses you don't want to resolve.
Aleron Ives wrote:This seems like a task best suited to browser-based blocking software, where you could use features such as analytics to see which filters are being used frequently and to prune filters that have no hits to speed up the process of checking the blocklist on each page you visit.
Nonsense. The file is loaded and the list checked in microseconds flat.

Re: How to block block ads, banners, 3rd party cookies, page counters, web bugs and hijackers

Posted: Tue Oct 24, 2017 1:53 am
by all41
hey catweasel how can you tell if it works?
please don't plonk me