Puppy Linux Discussion Forum Forum Index Puppy Linux Discussion Forum
Puppy HOME page : puppylinux.com
"THE" alternative forum : puppylinux.info
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

The time now is Thu 20 Nov 2014, 16:53
All times are UTC - 4
 Forum index » House Training » HOWTO ( Solutions )
Lighter alternative to AdBlock Plus
Moderators: Flash, Ian, JohnMurga
Post new topic   Reply to topic View previous topic :: View next topic
Page 1 of 1 [5 Posts]  
Author Message
cimarron

Joined: 30 May 2013
Posts: 120

PostPosted: Tue 25 Mar 2014, 17:11    Post subject:  Lighter alternative to AdBlock Plus  

A how-to about this was posted years ago by Iguleder, who explains how to block ads using the /etc/hosts file.

I found out about it by trying sc0ttman's Pup-Advert-Blocker, which makes the process easier (read the end of that thread to see recent changes). I used the "Systcl.org" hosts file (I think that's supposed to be Sysctl.org) and found it blocks almost as well as the Adblock Plus addon in Firefox. And it works for any browser, since it is not an addon.

I just wanted to highlight this again because I was surprised how much better Firefox ran using the /etc/hosts ad-blocking. I have a 12-year-old Thinkpad X24, with just 256M RAM, and Firefox's memory use can cause a lot of swapping, which slows everything down considerably. But when I removed a couple Adblock Plus subscription lists (using /etc/hosts instead) the memory use and swapping were greatly reduced and my savefile dropped 6MB. Webpages loaded much faster, flash video played better.

I still use the Adblock Plus addon for its ability to easily block any page elements you want gone (or find video streams in pages for downloading), but it's very light without the huge subscription lists.
Back to top
View user's profile Send private message 
Bruce B


Joined: 18 May 2005
Posts: 11131
Location: The Peoples Republic of California

PostPosted: Wed 07 May 2014, 03:22    Post subject: Re: Lighter alternative to AdBlock Plus  

cimarron wrote:
A how-to about this was posted years ago by Iguleder, who explains how to block ads using the /etc/hosts file.


I just skimmed over the thread referenced.

I didn't see anything mentioned about running a local web-server.

When using 127.0.0.1 as the address to route the request, this is saying in effect, "There is a server at this address". With 127.0.0.1 being a valid IP address for our computers but can only be accessed by our own computers.

The address 127.0.0.1 is true and the browser will look for a server there but it won't find it. The search for the browser continue until it times out.

If there is a lightweight server such as 'hiawatha' which is included with most if not all Puppys the server will be quickly found and return an appropriate error code.

When a server is not found a different error code is returned.

(I suspect that Ad Block Plus returns a error 200, which is good for us users)

If anyone wants to experiment I include some links.
http://127.0.0.1

http://127.0.0.1/somefile.txt

http://www.example.com

http://www.example.com/somefile.txt

(example.com is intended to be used for testing, teaching and other purposes, it expects to be used and abused)



Try it with and without hiawatha running, the user can determine for himself what he prefers.

~~~

What I would really like is for hiawatha to always return an error 200 (which basically says 'success')


I went through the code thinking it might be obvious how to accomplish this task, but it wasn't.

I would really appreciate it if someone could find a way to do this and post a how-to or attach the modified source code.

_________________
New! Puppy Linux Links Page
Back to top
View user's profile Send private message 
technosaurus


Joined: 18 May 2008
Posts: 4375

PostPosted: Wed 07 May 2014, 09:31    Post subject:  

You can use 0.0.0.0 to block completely.

I have used 127.0.0.1 to implement a local CDN proxy server for commonly used js libs and other resources (it cuts web traffic roughly in half), but 0.0.0.0 for sites I just wanted to block altogether so it didn't try to cache useless ads on my server.

_________________
Web Programming - Pet Packaging 100 & 101
Back to top
View user's profile Send private message 
cimarron

Joined: 30 May 2013
Posts: 120

PostPosted: Wed 07 May 2014, 10:49    Post subject:  

With subsequent experimenting, I found that the /etc/hosts blocking definitely works, but that most all ads on the pages I'm visiting are blocked by my use of the NoScript add-on (it seems most ads are loaded by scripts). I don't have to identify and block all the ad servers, since NoScript only allows the scripts I whitelist.

So that's another much lighter alternative to Adblock Plus with its huge subscription lists.
Back to top
View user's profile Send private message 
technosaurus


Joined: 18 May 2008
Posts: 4375

PostPosted: Wed 07 May 2014, 12:29    Post subject:  

NoScript only works on the browser that has it installed though. /etc/hosts applies the filter to all browsers, wget, curl, javascript ... anything that links to system libraries (pretty much everything, though I did write a test web server that replaced gethostbyname and other system functions in order to download /etc/hosts blocked resources with 127.0.0.1 ... so it could for example download jquery once and serve it locally from then on)

Here is a nice free list if you want to block more than ads:
ftp://ftp.ut-capitole.fr/pub/reseau/cache/squidguard_contrib/

_________________
Web Programming - Pet Packaging 100 & 101
Back to top
View user's profile Send private message 
Display posts from previous:   Sort by:   
Page 1 of 1 [5 Posts]  
Post new topic   Reply to topic View previous topic :: View next topic
 Forum index » House Training » HOWTO ( Solutions )
Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.0558s ][ Queries: 11 (0.0062s) ][ GZIP on ]