Turning filter list entries into URLs for a hosts file

Discuss various technical topics not related to Mozilla.
Post Reply
User avatar
psaulm119
Posts: 646
Joined: November 4th, 2007, 2:23 pm

Turning filter list entries into URLs for a hosts file

Post by psaulm119 »

Today I started experimenting with using a hosts file instead of an ablocking addon. I downloaded a very large (hundreds if not thousands of URLs in the MVPS.org hosts file) hosts file, installed it, and found that it was just as quick as my adblocking addons. I'm wondering if I can get quicker page loads, just with a few dozen of the main culprits. I'd like to take the entries in my ABP easylist filter and turn them into urls for my hosts file, but many of them are not even full urls.

For example, the top one is

@@||upload.wikimedia.org/wikipedia/

Right below that, I have
@@||twimg.com^$image,third-party

How would I turn those into a url? Instead of the @ signs, do I just put an asterisk and a dot?

Or--would this only shave microseconds off my pageload, and it is really not worth the time?
Paul
barbaz
Posts: 1504
Joined: October 1st, 2014, 3:25 pm

Re: Turning filter list entries into URLs for a hosts file

Post by barbaz »

HOSTS file is too limited to be able to usefully convert ABP filters to HOSTS lines. It is however possible to usefully convert some ABP filters into a format usable with some sort of "DNS proxy" such as dnsmasq that can match all subdomains of a domain.

Also, why are you looking to HOSTS-block ABP whitelist filters anyway?
User avatar
Grumpus
Posts: 13232
Joined: October 19th, 2007, 4:23 am
Location: ... Da' Swamp

Re: Turning filter list entries into URLs for a hosts file

Post by Grumpus »

Does Windows have anything like an IP Tables which would allow for the individual IP or URL to be blocked.
You might also be able, if you have access to put the ip or url in a firewall table.
What you run into is changing IPs if the advertiser is using a cloud based setup so url might be better.
Doesn't matter what you say, it's wrong for a toaster to walk around the house and talk to you
User avatar
psaulm119
Posts: 646
Joined: November 4th, 2007, 2:23 pm

Re: Turning filter list entries into URLs for a hosts file

Post by psaulm119 »

Used Frank Lion's hosts file http://forums.mozillazine.org/viewtopic ... #p13440965--scroll up to copy/see it---and so far, from what little I can tell, it is performing equal to or slightly faster than adblocking extensions. Plus, I don't see any warnings when I go to a site that complain about my use of adblockers.
Paul
barbaz
Posts: 1504
Joined: October 1st, 2014, 3:25 pm

Re: Turning filter list entries into URLs for a hosts file

Post by barbaz »

psaulm119 wrote:Used Frank Lion's hosts file
Direct link: http://forums.mozillazine.org/viewtopic ... #p13439261

Unless you are running a web server on 127.0.0.1 or something like that, and you actually want said server receiving requests you want "blocked", you're better off using "0.0.0.0" (ipv6 "::") instead. This way you won't be bombarding your own computer with these ad requests. More information: https://hackademix.net/2009/07/01/abe-w ... where-omg/ (do *not* use 255.255.255.0 as suggested in that article and elsewhere, when I tried that it caused MASSIVE slowdowns)
psaulm119 wrote:Plus, I don't see any warnings when I go to a site that complain about my use of adblockers.
(Because most - though not all - anti-adblock actually checks for ad hiding filters, not ad blocking filters.)
User avatar
Frank Lion
Posts: 21172
Joined: April 23rd, 2004, 6:59 pm
Location: ... The Exorcist....United Kingdom
Contact:

Re: Turning filter list entries into URLs for a hosts file

Post by Frank Lion »

psaulm119 wrote:Used Frank Lion's hosts file ...
...and so far, from what little I can tell, it is performing equal to or slightly faster than adblocking extensions. Plus, I don't see any warnings when I go to a site that complain about my use of adblockers.
Yeah, seems to work OK. I pretty much just hit the ad serving people themselves rather than individual ads and that's why the list is so short compared to most hosts files. I've added a few personal preferences to my list as well, even so it's a short list.

The only problem I've ever had is that, once in a blue moon, a good site will overlay an ad directly over a video that I want to watch. Because you've blocked the ad then the vid will not play. Doesn't happen often, but you just rename hosts to host1 and restart the browser and later revert that change.

It certainly is an extremely easy method, but I'm not 'religious' about this stuff and sometimes use an extension as well or instead of, but not often.
"The only thing necessary for the triumph of evil, is for good men to do nothing." - Edmund Burke (attrib.)
.
User avatar
Frenzie
Posts: 2135
Joined: May 5th, 2004, 10:40 am
Location: Belgium
Contact:

Re: Turning filter list entries into URLs for a hosts file

Post by Frenzie »

barbaz wrote:(Because most - though not all - anti-adblock actually checks for ad hiding filters, not ad blocking filters.)
I don't block ads, but I was told to turn on ads on Forbes or Slate or something along those lines when I didn't allow them to set cookies.
Intelligent alien life does exist, otherwise they would have contacted us.
User avatar
psaulm119
Posts: 646
Joined: November 4th, 2007, 2:23 pm

Re: Turning filter list entries into URLs for a hosts file

Post by psaulm119 »

Found that the hosts file let in a few ads, so I switched back to ABP.

Never would have considered looking around, but Nightly let me know that ABP might be slowing my browser down--gave me a warning at the bottom of the page. Went to about:support and found more detail on that, but of course I had no idea what they were talking about. oh well. With ABP I really haven't noticed any issues. Next time I see that message I'll just click on ignore permanently.
Paul
Post Reply