Ad-blocking with DD-WRT

Post new topic   Reply to topic    DD-WRT Forum Index -> Broadcom SoC based Hardware
Goto page Previous  1, 2, 3 ... 11, 12, 13 ... 17, 18, 19  Next
Author Message
uziq
DD-WRT User


Joined: 02 Jan 2008
Posts: 65

PostPosted: Sun Aug 31, 2008 0:17    Post subject: Reply with quote
I didn't know about mini_httpd, but AdServer can only run on Windows, so it'll be up to someone else to code a new program.

-----------
Thanks to the mvps hosts file and AdServer, I see that my network tries to load over 20,000 "ads" from 418 hosts every week. Shocked (www.google-analytics.com is leader at 3266 hits)
Sponsor
cyberde
DD-WRT Guru


Joined: 07 Jun 2006
Posts: 1488
Location: the Netherlands

PostPosted: Sun Aug 31, 2008 4:40    Post subject: Reply with quote
I think you can run mini_http, create an .htaccess file which defines a 404 page (in this case a blank HTML page) and that should be it.

I can't test it right now since I'm on a holiday but someone give it a shot Smile

_________________
Firmware: DD-WRT v24-sp2 (latest available) mega
WRT320N

Donater
darthn
DD-WRT Novice


Joined: 28 Jul 2008
Posts: 37

PostPosted: Tue Sep 02, 2008 5:22    Post subject: Reply with quote
Hopefully, this becomes a part of DD-WRT in the future.
frater
DD-WRT Guru


Joined: 07 Jun 2006
Posts: 2777

PostPosted: Thu Sep 04, 2008 8:15    Post subject: Reply with quote
darthn wrote:
Hopefully, this becomes a part of DD-WRT in the future.

I do hope not.
Some posts ago I wrote that the local hosts file is getting overwritten but somehow nobody cares.

There's no need for selfish scripts on DD-WRT.

_________________
Asus RT16N + OTRW
Kingston 4GB USB-disk 128 MB swap + 1.4GB ext3 on /opt + 2 GB ext3 on /mnt
Copperjet 1616 modem in ZipB-config
Asterisk, pixelserv & Pound running on router
Another Asus RT16N as WDS-bridge

DD-WRT v24-sp2 vpn (c) 2010 NewMedia-NET GmbH
Release: 12/16/10 (SVN revision: 15758M)
zekid
DD-WRT Novice


Joined: 23 Jan 2008
Posts: 12

PostPosted: Sat Sep 06, 2008 13:13    Post subject: Re: This is a 'must have' code for unwanted traffic Reply with quote
kardzzz wrote:
Guys,
My WRT54GL is running DD-WRT v24 RC-5 (11/22/07) std.

I have read through this whole thread and went with the code nick696 posted and it works perfectly.
Full instructions below. I hope he doesn't mind me re-posting.


This is my in the startup section:
Code:

logger WAN UP Script Executing
sleep 5
test -s /tmp/dlhosts
if [ $? == 1 ] ; then
echo -e "#!/bin/sh\nwget -O - http://www.mvps.org/winhelp2002/hosts.txt | grep 127.0.0.1 | tr -d '\015\032' | sed -e '2,\$s/127.0.0.1/0.0.0.0/g' -e 's/[[:space:]]*#.*$//' > /tmp/hosts\nlogger DOWNLOADED http://www.mvps.org/winhelp2002/hosts.txt\nkillall -1 dnsmasq" > /tmp/dlhosts
chmod 777 /tmp/dlhosts
/tmp/dlhosts
fi
ln -s /tmp/hosts /etc/hosts
echo "45 23 * * 5 root /tmp/dlhosts" >> /tmp/crontab


this is the script in the firewall section:
Code:

/tmp/dlhosts


I have:
1. In Basic Setup.
Use DNSMasq for DHCP - ENABLED
Use DNSMasq for DNS - ENABLED
DHCP-Authoritative - ENABLED

2. In services.
DNSMasq - Enable
Local DNS - Enable



THIS THREAD SHOULD BE PINNED.


Hi

dont know why but this script dont work with me

check please:




im running v24 sp1

tks
cyberde
DD-WRT Guru


Joined: 07 Jun 2006
Posts: 1488
Location: the Netherlands

PostPosted: Tue Sep 09, 2008 7:34    Post subject: Reply with quote
frater wrote:
darthn wrote:
Hopefully, this becomes a part of DD-WRT in the future.

I do hope not.
Some posts ago I wrote that the local hosts file is getting overwritten but somehow nobody cares.

There's no need for selfish scripts on DD-WRT.


It's not overwritten but appended, so that wouldn't cause any problems.
There's is ofcourse the problem that some hosts may be blocked which you don't want to be blocked.

That's why I created my own hosts-file on my webserver where I can remove and add hosts, based on the official one.

_________________
Firmware: DD-WRT v24-sp2 (latest available) mega
WRT320N

Donater
frater
DD-WRT Guru


Joined: 07 Jun 2006
Posts: 2777

PostPosted: Tue Sep 09, 2008 23:48    Post subject: Reply with quote
After I ran the script, none of my local hosts were able to resolve. This corresponds with what I'm reading in the script.
_________________
Asus RT16N + OTRW
Kingston 4GB USB-disk 128 MB swap + 1.4GB ext3 on /opt + 2 GB ext3 on /mnt
Copperjet 1616 modem in ZipB-config
Asterisk, pixelserv & Pound running on router
Another Asus RT16N as WDS-bridge

DD-WRT v24-sp2 vpn (c) 2010 NewMedia-NET GmbH
Release: 12/16/10 (SVN revision: 15758M)
TexasFlood
DD-WRT User


Joined: 17 Jun 2006
Posts: 335

PostPosted: Wed Sep 10, 2008 2:06    Post subject: Reply with quote
uziq wrote:
I didn't know about mini_httpd, but AdServer can only run on Windows, so it'll be up to someone else to code a new program.

Did you try Pixelserv? It's perl so you can run it either with free version of ActivePerl or compile it with perl2exe. I used v1.0 on Windows but use the one that works best for you.
kendogg
DD-WRT Novice


Joined: 09 Sep 2008
Posts: 3

PostPosted: Wed Sep 10, 2008 7:47    Post subject: Reply with quote
running V24 and I don't have a section to type in the syntax for the firewall category. Will this cause issues or would I need to upgrade to SP1
uziq
DD-WRT User


Joined: 02 Jan 2008
Posts: 65

PostPosted: Wed Sep 10, 2008 18:08    Post subject: Reply with quote
TexasFlood wrote:
uziq wrote:
I didn't know about mini_httpd, but AdServer can only run on Windows, so it'll be up to someone else to code a new program.

Did you try Pixelserv?

No. I'm sure that does the trick, but AdServer.exe has been working great for me, so I don't see the need to use something else.

(603 hosts, 50553 ads blocked, and counting!) Very Happy
TexasFlood
DD-WRT User


Joined: 17 Jun 2006
Posts: 335

PostPosted: Wed Sep 10, 2008 19:44    Post subject: Reply with quote
uziq wrote:
TexasFlood wrote:
uziq wrote:
I didn't know about mini_httpd, but AdServer can only run on Windows, so it'll be up to someone else to code a new program.

Did you try Pixelserv?

No. I'm sure that does the trick, but AdServer.exe has been working great for me, so I don't see the need to use something else.

(603 hosts, 50553 ads blocked, and counting!) Very Happy
Agreed that AdServer is a great program. I was just suggesting pixelserv for non-windows.
cyberde
DD-WRT Guru


Joined: 07 Jun 2006
Posts: 1488
Location: the Netherlands

PostPosted: Thu Sep 11, 2008 6:38    Post subject: Reply with quote
Has anyone gotten Pixelserv to run on DD-WRT? That would be the ultimate solution ofcourse Smile
_________________
Firmware: DD-WRT v24-sp2 (latest available) mega
WRT320N

Donater
tange1
DD-WRT Novice


Joined: 06 Aug 2006
Posts: 41

PostPosted: Wed Oct 08, 2008 1:49    Post subject: Reply with quote
If I wanted to back this out how can I? What is the line for the firewall? I should have backed up what was there before...
es1013
DD-WRT Novice


Joined: 08 Oct 2008
Posts: 17

PostPosted: Wed Oct 08, 2008 19:59    Post subject: ad block - tried everything Reply with quote
Hey all,

I've read all 12 pages of this topic several times, and have tried everything to no avail. I still have ads and can ping doubleclick.com through telnet. I have some questions that might clear things up for me and some other people who are also still having issues.
First, my specs:

WRT54GS v6 running dd-wrt 2.4sp1 MICRO
Static DNS 1 & 2 - OpenDNS servers
Use DNSMasq for DHCP - Enabled
Use DNSMasq for DNS - Enabled
DHCP-Authoritative - Enabled

DNSMasq - Enabled
Local DNS - Enabled

message from syslogd is:
Quote:
10-08-2008 11:06:44 User.Notice 192.168.1.1 Oct 8 11:06:43 root: DOWNLOADED http://www.mvps.org/winhelp2002/hosts.txt


So the message from syslogd shows that the script runs, or at least tries to.. there's no error messages in the log, so I'm pretty confused how this works for so many people and yet not for so many others.

Question 1: Does the ad blocking script work on all builds of dd-wrt? If not, which ones are compatible? The micro build has 2 megs of ram, and the mvps hosts file is about 650k.

Question 2: Are there more problems running the script with the sp1 release of 2.4? Some people have said it hasn't worked for them since they upgraded.

Question 3: I don't know much unix. Whats the difference between the two different versions of code posted? One version has "tr -d", another doesn't.
snippet from code 1:
Code:

echo -e "#!/bin/sh\nwget -O - http://www.mvps.org/winhelp2002/hosts.txt | grep 127.0.0.1 | tr -d '\015\032' | sed -e '2,\$s/127.0.0.1/0.0.0.0/g' -e 's/[[:space:]]*#.*$//' > /tmp/hosts\nlogger DOWNLOADED http://www.mvps.org/winhelp2002/hosts.txt\nkillall -1 dnsmasq" > /tmp/dlhosts
chmod 777 /tmp/dlhosts
/tmp/dlhosts
fi
ln -s /tmp/hosts /etc/hosts
echo "30 18 * * 1 root /tmp/dlhosts" >> /tmp/crontab


snippet from code 2:
Code:

echo -e "#!/bin/sh\nwget -O - http://www.mvps.org/winhelp2002/hosts.txt | grep 127.0.0.1 | sed -e '2,\$s/127.0.0.1/0.0.0.0/g' -e 's/[[:space:]]*#.*$//' > /tmp/hosts\nlogger DOWNLOADED http://www.mvps.org/winhelp2002/hosts.txt\nkillall -1 dnsmasq" > /tmp/dlhosts
chmod 777 /tmp/dlhosts
/tmp/dlhosts
fi
ln -s /tmp/hosts /etc/hosts
echo "00 11 * * 3 root /tmp/dlhosts" >> /tmp/crontab


Question 4: For those who use OpenDNS (or another DNS service), are there any settings which need to be different? I've had the WinXP DNS client disabled, since thats being done in the router. But should any setting be different if someone isn't using their default ISP DNS servers?


Thanks in advance. I know not to expect much from the micro builds, but it's worth a shot.

**edit: I found this, which might explain why the script doesn't work with micro version:
Quote:

Micro versions have a stripped down version of BusyBox, so it might not include the ln command

Micro versions also seem to be missing tr, sed, and nget.


Last edited by es1013 on Thu Oct 09, 2008 12:35; edited 2 times in total
frater
DD-WRT Guru


Joined: 07 Jun 2006
Posts: 2777

PostPosted: Wed Oct 08, 2008 20:58    Post subject: Reply with quote
es1013 wrote:
Hey all,
I've read all 12 pages of this topic several times, and have tried everything to no avail. I still have ads and can ping doubleclick.com through telnet.

Nothing is blocked with this script. DD-WRT's DNS-server is used to resolve all those nasty hostnames to 0.0.0.0
It will only work if your DD-WRT is your DNS-server

If you can resolve doubleclick.net to 216.73.93.8 then this script is not stopping you to get to them.


Now about this script. It needs just a little modification to work properly, but I'm not going to do it.

/etc/hosts is a symbolic link to /tmp/hosts
This file is filled with all your local hosts.

This file gets overwritten by the file that gets downloaded....
This means /etc/hosts doesn't contain the local hostnames anymore.

I have reported this before, but with a mixture of arrogance and ignorance nothing is done with this info..

The idea is good, but the implementation isn't


A hint.... use >> to concatenate the data to the host and leave out the whole cron-idea... It's just a reasonably static blacklist and it only needs to be freshened on startup, really...

_________________
Asus RT16N + OTRW
Kingston 4GB USB-disk 128 MB swap + 1.4GB ext3 on /opt + 2 GB ext3 on /mnt
Copperjet 1616 modem in ZipB-config
Asterisk, pixelserv & Pound running on router
Another Asus RT16N as WDS-bridge

DD-WRT v24-sp2 vpn (c) 2010 NewMedia-NET GmbH
Release: 12/16/10 (SVN revision: 15758M)
Goto page Previous  1, 2, 3 ... 11, 12, 13 ... 17, 18, 19  Next Display posts from previous:    Page 12 of 19
Post new topic   Reply to topic    DD-WRT Forum Index -> Broadcom SoC based Hardware All times are GMT

Navigation

 
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 can attach files in this forum
You can download files in this forum