WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: Network HOSTS filtering file -  (Read 6241 times)

Offline ACRizona

  • Jr. Member
  • **
  • Posts: 61
Network HOSTS filtering file -
« on: December 02, 2010, 07:54:14 PM »
Have always used HOSTS filtering on windows,,,  and copied the same file to TC.
WOW  ::) seems like the turbo-charger just kicked in !

FYI:  The HOSTS file provides IP addresses for WorthLess.com web sites.
By routing WorthLess.com to 127.0.0.0 ,,, you get nothing.  And nothing is FAST !

Problem: Windows has HOMER, a micro-small http server, that provides a dummy-page to any request.  Maybe just a blank icon... anything to avoid peppering a page with "Not Found" errors. 
I cannot find such a thing for Linux.
I tried MONKEY.  A fine little server, but I don't know how to set it up to provide the dummy-page.
 I also found a JavaScript server for the same purpose, but I dont know how to get it going.

Any suggestions are appreciated.

Offline gutmensch

  • Retired Admins
  • Hero Member
  • *****
  • Posts: 605
  • I can make it disappear, have no fear!
    • remembrance blog
Re: Network HOSTS filtering file -
« Reply #1 on: December 06, 2010, 06:09:11 AM »
Just to get your idea right...

You use the windows ...drivers/etc/hosts file for some kind of spam/worthless site blocking, right?

Take a look at the info of busybox-httpd.tcz extension, or lighttpd, or apache2, or nginx, or all the others. ;-)

btw your worthless domains should point to 127.0.0.1. every of those web servers mentioned above will serve under that address if started.
If I seem unduly clear to you, you must have misunderstood what I said. (Alan Greenspan)

Offline ACRizona

  • Jr. Member
  • **
  • Posts: 61
Re: Network HOSTS filtering file -
« Reply #2 on: December 07, 2010, 01:40:38 AM »
You are 'right-on'... thats the way it works....   In practice, MS and Mozilla browsers take a performance hit if the request is not answered.  My guess is error-handling out-weighs the overhead of a 'Homer'-server substituting blank responses.  FFox sprays huge "Not Found error.." all over the page !

My problem is finding a 127.0.0.1-micro-server that can serve a blank.bmp file to port 80.
None of the five I tested would do that.  I stopped looking for a 'Homer' that runs on Linux.

I am currently testing Opera which operates just fine with a Hosts file.
Thanks.

Offline tinypoodle

  • Hero Member
  • *****
  • Posts: 3857
Re: Network HOSTS filtering file -
« Reply #3 on: December 07, 2010, 02:20:32 AM »
FYI, opera features native content blocking.
"Software gets slower faster than hardware gets faster." Niklaus Wirth - A Plea for Lean Software (1995)

Offline danielibarnes

  • Hero Member
  • *****
  • Posts: 548
Re: Network HOSTS filtering file -
« Reply #4 on: December 07, 2010, 10:56:46 AM »
If you want a "homer" server for Linux, use socat. Here is an example:

socat TCP-LISTEN:80,bind=127.0.0.1,fork,reuseaddr,crlf SYSTEM:"echo HTTP/1.0 200; echo Content-Type: text/plain; echo;" &

Offline ACRizona

  • Jr. Member
  • **
  • Posts: 61
Re: Network HOSTS filtering file -
« Reply #5 on: December 08, 2010, 03:00:00 AM »
If you want a "homer" server for Linux, use socat. Here is an example:


That was too simple  :o   Its running now,,, now we can visit most all the airlines, hotels, news, shopping, and . sites at top speed, without worry....
wait-a-sec.... thats what the 4000-line Hosts file is all about !!!

Danielibarnes gets 1 ATTA BOY

Offline tinypoodle

  • Hero Member
  • *****
  • Posts: 3857
Re: Network HOSTS filtering file -
« Reply #6 on: December 08, 2010, 03:28:58 PM »
What? 4000 lines? There must be double entries or not very intelligent use of wildcards; when I get nearly no ads at all with my opera urlfilter.ini
...oops, that's 5155 lines   :o

I had no idea   :P
"Software gets slower faster than hardware gets faster." Niklaus Wirth - A Plea for Lean Software (1995)

Offline ACRizona

  • Jr. Member
  • **
  • Posts: 61
Re: Network HOSTS filtering file -
« Reply #7 on: December 08, 2010, 04:09:48 PM »
Who said: "If it ain't broke, don't fix it !"    ;)

I added -lf socat.log to socat, hoping it would log activities.  
Nope - it logs "broken pipe" errors.   <-- being a home-owner,,, those are BAD !

Google/linux has many references to socat, but I cannot find the how-tos.
Does it have a TCP-activity-log capability ?  

Offline danielibarnes

  • Hero Member
  • *****
  • Posts: 548
Re: Network HOSTS filtering file -
« Reply #8 on: December 08, 2010, 04:29:23 PM »
The man page indicates:

-d
Without this option, only fatal and error messages are generated; applying this option also prints warning messages. See DIAGNOSTICS for more information.

-d -d
Prints fatal, error, warning, and notice messages.

-d -d -d
Prints fatal, error, warning, notice, and info messages.

-d -d -d -d
Prints fatal, error, warning, notice, info, and debug messages.

-D
Logs information about file descriptors before starting the transfer phase.

-ly[<facility>]
Writes messages to syslog instead of stderr; severity as defined with -d option. With optional <facility>, the syslog type can be selected, default is "daemon".

-lf <logfile>
Writes messages to <logfile> [filename] instead of stderr.

Offline ACRizona

  • Jr. Member
  • **
  • Posts: 61
Re: Network HOSTS filtering file -
« Reply #9 on: December 08, 2010, 04:38:05 PM »
TinyPoodle refers to urlfilter.ini (Google: fanboy ?) which is a huge file of world-wide/wild-carded/worthless web sites that Opera's built-in filtering uses.
The built-in filtering is a much more modern (and preferred) method of filtering.

IF you have a modern super-fast PC with lots of memory.

Unfortunately, my old P-III 256MB laptop does not fit in that category.
By the time it loads Opera with flash add-ons, fanboy filter,,, wait a minute,
I have to plug in my charger  :'(

Offline ACRizona

  • Jr. Member
  • **
  • Posts: 61
Re: Network HOSTS filtering file -
« Reply #10 on: December 08, 2010, 04:55:53 PM »
I'm sorry...  lets go back to Who said: "If it ain't broke, don't fix it !"

Socat sees only requests to/from 127.0.0.1  :P

Adding -d -d -d to socat quickly fills the log with 127.0.0.1 activities !
I wished to see the Hosts-file substitution.
... but I guess its not broke  :-[



Offline danielibarnes

  • Hero Member
  • *****
  • Posts: 548
Re: Network HOSTS filtering file -
« Reply #11 on: December 08, 2010, 05:17:25 PM »
The "bind=127.0.0.1" parameter to socat means it only listens on the loopback interface. Are you saying you'd like to see what URL was requested? If so, modify your line like this:

socat TCP-LISTEN:80,bind=127.0.0.1,fork,reuseaddr,crlf SYSTEM:"head -1 >> /tmp/homerlog; echo HTTP/1.0 200; echo Content-Type: text/plain; echo;" &

This will dump GET requests into /tmp/homerlog.

Offline tinypoodle

  • Hero Member
  • *****
  • Posts: 3857
Re: Network HOSTS filtering file -
« Reply #12 on: December 08, 2010, 05:38:52 PM »
TinyPoodle refers to urlfilter.ini (Google: fanboy ?) which is a huge file of world-wide/wild-carded/worthless web sites that Opera's built-in filtering uses.
The built-in filtering is a much more modern (and preferred) method of filtering.

IF you have a modern super-fast PC with lots of memory.

Unfortunately, my old P-III 256MB laptop does not fit in that category.
By the time it loads Opera with flash add-ons, fanboy filter,,, wait a minute,
I have to plug in my charger  :'(

You guessed quite right, I use the fanboy list as a base and then add to it with "block content", at current it is 93Kb.
I haven't really an idea about the impact on resource usage, did you do any testing or reading about that? (btw, I have plug-ins globally deactivated and allowing per exception only, and in very recent versions of opera "flash on demand" is native anyway).
arora would come with adblocking (and "flash on demand") out of the box.

But the way I figure it is that using the method of a hosts file, the browser would still attempt to send requests, while as with using url filtering, requests would be disregarded at browser level in the first place. Correct me if I am wrong.

And what about running socat? Isn't that consuming any resources?
"Software gets slower faster than hardware gets faster." Niklaus Wirth - A Plea for Lean Software (1995)

Offline ACRizona

  • Jr. Member
  • **
  • Posts: 61
Re: Network HOSTS filtering file -
« Reply #13 on: December 20, 2010, 03:42:38 AM »
Watching top is not my favorite hobby... 
Opera9.64 is currently VSZ=63000 9.7% and socat is VSZ=2080 0.8%
( while I was Xmas shopping, socat was once 1.3% ).

I have turned off sound, flash, plug-ins, auto-refresh, and other oddities, to gain as much speed as possible.  It is much faster than Firefox, and nearly as fast as Midori. 
I tinkered with some of the horrible add-on widgets.  Waste of resources. 

I prefer to use the old-school HOSTS file filtering simply because I can easily keep the HOSTS updates in sync with my router-filter tables and share that same file on all PC/laptops without regard to what OS or browser is used.   That eliminates MOST of the crap.  However, I still subscribe to specialized filters for the sub-teen grandchildren, so I can let them play safely on the web. 
Another nifty filter is WOT, a very popular Firefox add-on.  It maintains a user-rating database and shows red/yellow/green scores on all web pages,  Cute & handy. 

I often preach that virus-protection programs are practically useless without effective filtering.

Anyway,,, back to performance.  Are these numbers inline with your observations ?
Do you have any silver bullets that make Opera even faster ?
 



   

   

Offline curaga

  • Administrator
  • Hero Member
  • *****
  • Posts: 11044
Re: Network HOSTS filtering file -
« Reply #14 on: December 20, 2010, 04:33:54 AM »
Yeah, Opera tends to hover around 10% cpu here as well.
The only barriers that can stop you are the ones you create yourself.