Posted: Thu Oct 09, 2008 1:51 Post subject: Re: ad block - tried everything
*sorry about the double-post before
Seems like there's too many commands missing from BusyBox in the micro version - nget, tr, sed, ln. Would wget work? I couldn't really find any documentation on nget online.
Maybe I can manually format the hosts file, and then upload it instead of retrieving it from mvps. It would be real sweet if we could get this to work on all dd-wrt versions.
Thanks for the help so far.
Last edited by es1013 on Thu Oct 09, 2008 12:33; edited 1 time in total
But there's no need to run this command.
That symbolic link already exists. There's no need to run that command again.
The author somehow thinks this link has to be refreshed... _________________ 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
That's a better solution, but I still think the cronjob is close to useless.... _________________ 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
notice "ln" has been removed. this was not needed since /etc is read only.
now, under DNSMasq add this to "Additional DNSMasq Options"
Code:
addn-hosts=/tmp/adblock
thats it. now it will block ads, and still keep your host file.
enjoy
speedy3k's instruction worked perfectly except that in my case /etc/crontab didn't get altered by the startup script. I used the gui field
Administration->Management-> additional cron jobs
as a workaround and added :
33 10 * * 4 root /tmp/dlhosts
to get cron job in /etc/cron.d/cron_jobs
Also, the whole thing (obviously?) only worked AFTER I removed the DNS entries in my Mac's network setup. (Sys Pref-> Network->advance->DNS)
As I said before... The idea is good, but the implementation imho is flawed. Some things are done that are not needed and some things that are needed are not done.
The script will write a script that results in this code:
if [ "`grep -c doubleclick /tmp/dlhosts`" -ne "0" ]; then
break
fi
sleep 60
done
killall -HUP dnsmasq
The download is inside an "endless" loop and it will try to download the host file. If it doesn't succeed (the file should contain doubleclick) it will wait a minute and try again. The script is only executed once. afterwards dnsmasq is signalled to reload its config. Do note the ampersand which makes it possible for the router to continue the rest of the startup. Some empty lines are killed, double spaces are converted to single tabs and last but not least.... localhost still is 127.0.0.1
Comments are welcomed... _________________ 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
#!/bin/sh
while true
do
wget -q -O - http://www.mvps.org/winhelp2002/hosts.txt | grep "^127.0.0.1" | awk '{print $1"\t"$2}' | sed -e 's/127.0.0.1/0.0.0.0/g' | grep -v localhost >/tmp/dlhosts
if [ "`grep -c doubleclick /tmp/dlhosts`" -ne "0" ]; then
break
fi
sleep 60
done
killall -HUP dnsmasq
_________________ 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
This pixelserv is a great idea so I'm now running it on my fedora on an extra IP. If someone wants to know how, I will write an howto..
By changing "rogue" to another IP where pixelserv is running on port 80, you can speedup browsing even more... I re-added the deleting of the carriage return...
This version adds google-analytics.com "by hand" to the extra hostfile... Anyone knows why it isn't in the original file? I added it because it received the most hits in the firefox addon "adblock".
Anyone knows of any other "missing" entries?
On second thought...
It is better to save your own blocked hosts in a file called /jffs/hosts and add that too.....
No comments?
If anyone knows some more blocklists I can write something that puts them all together.... _________________ 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
On second thought...
It is better to save your own blocked hosts in a file called /jffs/hosts and add that too.....
No comments?
If anyone knows some more blocklists I can write something that puts them all together....
I added google-analytics.com to /jffs/hosts and then added it to dnsmasq parms as a 2nd additional hosts file and kept the original looping script..good idea....You would think you could write some sort of rule that would redirect 404's pointing to localhost to a standard image and leave others as normal 404.
> You would think you could write some sort of rule that would redirect 404's pointing to localhost to a standard image and leave others as normal 404.
By running a very tiny perl script called pixelserv on port 80 you can use that IP....
All my machines already have a webserver running on port 80, so I added an extra static IP on my Linux-machine and used that to run "pixelserv" on.
http://proxytunnel.sourceforge.net/pixelserv.php _________________ 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
Has anyone gotten Pixelserv to run on DD-WRT? That would be the ultimate solution ofcourse
pixelserv needs perl...
But it also needs to be run on port 80 and the webinterface is already running there....
This could be solved by running the webserver on another port which would involve restarting the webserver and the risk it will get restarted by another script...
The easiest thing for me to do was adding an extra IP to my linux-server and run pixelserv on that... _________________ 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
Adding a 2nd addn-hosts to /jffs/hosts doesn't work.
Because google-analytics.com was correctly resolved to 192.168.10.5 I thought it was working, but I was still running the version in which I add it 'by hand' int the script.
Due to this presumption I thought it was working but in fact it wasn't. I only found out just now after I added rad.msn.com
So please disregard my post about adding a 2nd dnsmasq.
Maybe it's better to improve this list and host it somewhere on a fast free webserver...
Any suggestions????
Someone already said he was downloading his own file... Can you please comment?
I could write a little script that runs on a server which periodically downloads the script and removes some hosts from an exclude-list and includes some... _________________ 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