Democratic Underground Latest Greatest Lobby Journals Search Options Help Login
Google

Nice Windows trick to prevent browser from loading ads

Printer-friendly format Printer-friendly format
Printer-friendly format Email this thread to a friend
Printer-friendly format Bookmark this thread
This topic is archived.
Home » Discuss » Topic Forums » Science Donate to DU
 
RobertSeattle Donating Member (1000+ posts) Send PM | Profile | Ignore Fri Sep-02-05 05:11 PM
Original message
Nice Windows trick to prevent browser from loading ads
If you are a Windows user, you can use the "Hosts" file that you can download from the url, replace your current one, and anytime you go to a site with lots of ads your browser won't even try to download them since they have been mapped to your own computer (127.0.0.1). I've used this for the past couple of days and it works like a charm.

Note: Do not use this on a corporate LAN computer - your IT people probably don't want you messing with your HOSTS file.

(This is especially nice when the Internet seems slow)

http://www.mvps.org/winhelp2002/hosts.htm


Enjoy.
Printer Friendly | Permalink |  | Top
dweller Donating Member (1000+ posts) Send PM | Profile | Ignore Fri Sep-02-05 05:15 PM
Response to Original message
1. will it block the ones
here?

dp

Printer Friendly | Permalink |  | Top
 
evermind Donating Member (833 posts) Send PM | Profile | Ignore Fri Sep-02-05 06:05 PM
Response to Reply #1
2. Yep, if you get the hosts file from that link. If that bothers
you, just edit the file and remove all the lines that have "blogads" in them.
Printer Friendly | Permalink |  | Top
 
dweller Donating Member (1000+ posts) Send PM | Profile | Ignore Fri Sep-02-05 06:38 PM
Response to Reply #2
4. oh no, doesn't bother me
as much as the ads do.

thanks!
dp
Printer Friendly | Permalink |  | Top
 
evermind Donating Member (833 posts) Send PM | Profile | Ignore Fri Sep-02-05 06:27 PM
Response to Original message
3. Nice Linux trick for the same
Edited on Fri Sep-02-05 06:56 PM by evermind
(of course you could use the file /etc/hosts in the exact same way as for windows, in the OP, but that's just TOO DARN EASY for us Linux folk!)

First, go off to google and do an images search for "spam". Collect up a few smallish spam pictures of your choice and keep them somewhere safe.

Now, get the list of domains from that windows hosts file, and write a simple script to generate entries from them for your name server's config file (you DO run your own name server, I HOPE!) like so:

Excerpt from named.conf:

zone "ads.infospace.com" IN {
type master;
file "pri/spam.dom";
allow-update { none; };
notify no;
};
zone "ads.msn.com" IN {
type master;
file "pri/spam.dom";
allow-update { none; };
notify no;
};
zone "ads.switchboard.com" IN {
type master;
file "pri/spam.dom";
allow-update { none; };
notify no;
};
zone "doubleclick.net" IN {
type master;
file "pri/spam.dom";
allow-update { none; };
notify no;
};

... etc.


Notice they all reference the same zonefile. That zonefile will look something (or exactly) like this:

Excerpt from pri/spam.dom zonefile:

$TTL 1W
@ IN SOA ns.localhost. root.localhost. (
2002081602 ; Serial
28800 ; Refresh
14400 ; Retry
604800 ; Expire - 1 week
86400 ) ; Minimum
IN NS ns
@ IN A 1.2.3.4
* IN A 1.2.3.4


Notice the wildcard entry in the bottom line that points anyhost.spam.domain at the same IP address. Make the IP address (shown here as 1.2.3.4) the address of a machine that you control. That will be our spamserver.

On the spamserver machine, get the apache webserver going and give it a virtual hosts configuration entry like this:

Excerpt from vhosts.conf:

NameVirtualHost 1.2.3.4
<VirtualHost spam>
Servername *
AliasMatch .* /some/directory/spam.php
ServerPath /some/directory/spam
DocumentRoot /some/directory/spam
ErrorLog /var/log/apache2/spam-error_log
</VirtualHost>


Note the wildcard entries that mean any request whatsoever to the server on that IP will end up being answered by our script /some/directory/spam.php . (If that's a problem because you want to have other content on your web server, just use an additional alias interface for the spamserver, eg. ifconfig eth0:1 1.2.3.4, or even ifconfig lo:1 127.1.2.3 on a standalone machine.. Make sure the address you choose matches the one in the spam.dom zonefile.)

The spam.php script is very simple, and looks like this:

spam.php:

<?
$filenum = rand(1,25);
$file = $filenum . '.jpg';
Header('Content-type: image/jpg');
readfile($file);
?>


As can be seen, any request made to the script is answered by a random image from the same directory as the script, the images having been named 1.jpg, 2.jpg, ... 25.jpg. Rename the spam images collected earlier in this way, dump them in the directory with spam.php and you are ready to go.

The result is that wherever you would previously have had advertisement images in webpages you view, you have instead the delightful spectacle of various images of cans of spam, etc. (or whatever you chose to put there) with the compelling side benefit that your requests to evilcorporation.com are not setting cookies in your browser, either. (The windows method gives you that too, but with ugly "broken image" icons in place of the beautiful spam artwork....)



(Edit for formatting)
Printer Friendly | Permalink |  | Top
 
dweller Donating Member (1000+ posts) Send PM | Profile | Ignore Sat Sep-03-05 01:11 PM
Response to Original message
5. i am having MAJOR problems now with this 'fix'
and would appreciate a little more info concerning this procedure.

I went to the link, downloaded, unzipped and placed that 'host' file in the folder instructed. I was asked if i wanted to replace the 'host' file (created xxxxx) with this new one, i clicked yes.

then my computer quit, zilch. nothing for the last few hours. Rebooting 3x didn't help, in fact i couldn't even shut it down, had to do that manually. Starts up, but takes forevvvvvvvvvvvvvvvvvvvvvvvvvvvvver to do anything!
Tried to connect to my ISP (dialup) and cannot do, NOR can i cancel the connection...have to unplug the phone line, or shut off computer.

On bootup, the services.exe runs at 98%, CPU usage 100% for 5 minutes or longer. It took me 10 minutes to open my C: drive , another 5 to get back to that 'host file' and drag it out to my desktop. I attempted this after 2 hours of struggling just getting it the computer back on after many reboots, attempts to connect, waiiiiiiiiiitttttttttttttttttttttting for any process to complete the simplist task.

and now, at that point, everything is fine.

what the HELL is that doing to help me??? or can anyone explain what i may have done wrong? I followed the instructions carefully, and now have no 'host' file in the winnt/system32/drivers/etc folder.

I noticed at the link, there is a note about win2000, which i am running. But the previous 'host' file i had was 600k, and this new one is smaller 328k, so it's not b/c this one is larger.
And there is another editor's note about fixing manually, which i'm really hestitant to attempt considering how f'edd up this file info left me already.

ANY info from someone here would be greatly appreciated.

dp
Printer Friendly | Permalink |  | Top
 
evermind Donating Member (833 posts) Send PM | Profile | Ignore Sat Sep-03-05 03:46 PM
Response to Reply #5
6. Wow - sounds drastic!
Edited on Sat Sep-03-05 04:00 PM by evermind
I'm glad I'm not the poster of the original message! (Or the author of the page whose instructions you followed..)

In fact, I hardly use windows, so I may not be the best person to get advice on that OS from.

The default \WINNT\system32\drivers\etc\hosts file installed by win2k is as follows:


# Copyright (c) 1993-1999 Microsoft Corp.
#
# This is a sample HOSTS file used by Microsoft TCP/IP for Windows.
#
# This file contains the mappings of IP addresses to host names. Each
# entry should be kept on an individual line. The IP address should
# be placed in the first column followed by the corresponding host name.
# The IP address and the host name should be separated by at least one
# space.
#
# Additionally, comments (such as these) may be inserted on individual
# lines or following the machine name denoted by a '#' symbol.
#
# For example:
#
# 102.54.94.97 rhino.acme.com # source server
# 38.25.63.10 x.acme.com # x client host

127.0.0.1 localhost


Since the '#' at the beginning of the line makes that line be ignored, the only active line in this file is the last one:

127.0.0.1 localhost

So if the one you had was 600K, and you hadn't already edited it, some program must have put a lot of data in that file. I've no idea what program that might be, or why changing the file should lock up your machine. Except perhaps if you didn't have the line

127.0.0.1 localhost

it's conceivable that windows wouldn't like it. I dunno. It may be worth creating the file and pasting the content above into it.

To save the file in notepad, as I recall, you have to do a "save as" then select "save file as type: all files" and put in the filename as "hosts." (notice the dot at the end of that).

( On edit: three points.

Firstly, it might be worth really really checking the exact path of the file that you deleted, if that's possible, or at least make sure you don't currently have a \WINNT\system32\drivers\etc\hosts file (which would indicate a mistake during installing the file in the first place).

Secondly, as you can see from reading the comments in microsoft's default file, above, the file at the link given in the OP is entirely valid, and shouldn't cause trouble unless some other program in your system relies on particular contents being in it. If replacing the default doesn't fix things, your efforts should be concentrated on discovering what that program is

Thirdly, as a piece of general advice - when messing about with system files, never delete them. rename them instead (just add "old-" in front of the original name) - that way you have a good chance of recovering in case of errors.)
Printer Friendly | Permalink |  | Top
 
dweller Donating Member (1000+ posts) Send PM | Profile | Ignore Sat Sep-03-05 04:17 PM
Response to Reply #6
7. my friend, thank you so very much
Edited on Sat Sep-03-05 04:21 PM by dweller
i have created the file and saved it there. I'll see if it works after logging off.

i've stayed connected since i got on earlier, didn't want to go thru whatever i did before, again.

i wish i had remembered the 3rd gen.advice you mentioned earlier. . . but i will in the future.

okay, will check back later.

dp
------------------

edit: :thumbsup: :bounce:

now, i will attempt to work with the OP's file again at some point, BUT save the hosts. file for backup.

thanks again.
dp

Printer Friendly | Permalink |  | Top
 
greyl Donating Member (1000+ posts) Send PM | Profile | Ignore Tue Sep-06-05 04:25 AM
Response to Original message
8. It would be be better to
install the Firefox browser and it's
Adblock and NoScript extensions.


Easily right click any unwanted picture or i-frame and never have to see it again, plus much more for experienced users.

Your ad-aware and spybot will be left with little if anything to do. ;)
Printer Friendly | Permalink |  | Top
 
DU AdBot (1000+ posts) Click to send private message to this author Click to view 
this author's profile Click to add 
this author to your buddy list Click to add 
this author to your Ignore list Thu Dec 26th 2024, 05:43 AM
Response to Original message
Advertisements [?]
 Top

Home » Discuss » Topic Forums » Science Donate to DU

Powered by DCForum+ Version 1.1 Copyright 1997-2002 DCScripts.com
Software has been extensively modified by the DU administrators


Important Notices: By participating on this discussion board, visitors agree to abide by the rules outlined on our Rules page. Messages posted on the Democratic Underground Discussion Forums are the opinions of the individuals who post them, and do not necessarily represent the opinions of Democratic Underground, LLC.

Home  |  Discussion Forums  |  Journals |  Store  |  Donate

About DU  |  Contact Us  |  Privacy Policy

Got a message for Democratic Underground? Click here to send us a message.

© 2001 - 2011 Democratic Underground, LLC