ad-blocking with DD-WRT revisited (simple)

Post new topic   Reply to topic    DD-WRT Forum Index -> Broadcom SoC based Hardware
Goto page Previous  1, 2, 3 ... 11, 12, 13, 14  Next
Author Message
blaser
DD-WRT Guru


Joined: 16 Jul 2006
Posts: 525

PostPosted: Fri Jun 03, 2016 17:11    Post subject: Reply with quote
jmgraves8 wrote:
blaser wrote:
jmgraves8 wrote:
I can't block ads at all on my Linksys WRT54G v8 router with DD-WRT v24 RC-5 (11/22/07) micro. Both DNSMasq and Local DNS are enabled, and additional options and startup commands were input properly. I rebooted the router and ran nslookup on something that should be blocked (fr.a2dfp.net), yet I'm getting a valid IP back, not 0.0.0.0. This occurs on all test sites I type in.


Micro build doesn't have all the commands needed to run this utility.
Log in to the router, go to /tmp and look for the script, then run it, you will see the error messages


So is there any way I can get this router to do what I'd like? Do I need to flash a different DD-WRT?

I'm not that you can, it has very small flash memory.
you can buy today from Amazon EA6500V1 for $50, very good router

_________________
Netgear R9000 main router
RAX80 as AP
Sponsor
jmgraves8
DD-WRT Novice


Joined: 02 Jun 2016
Posts: 3

PostPosted: Sat Jun 04, 2016 14:23    Post subject: Reply with quote
blaser wrote:
I'm not that you can, it has very small flash memory. you can buy today from Amazon EA6500V1 for $50, very good router


Thank you for the suggestion.
tweakradje
DD-WRT Novice


Joined: 25 Sep 2008
Posts: 34

PostPosted: Mon Jun 06, 2016 14:02    Post subject: Reply with quote
If you want it really simple (for use on micro build routers)

Add to startup script:
Code:
# wait a bit after boot
sleep 20

# get a host file from internet with ad block
# write them to /tmp/hosts (live hosts file on your router)
wget -qO- http://adaway.org/hosts.txt|grep "^127.0.0.1" >> /tmp/hosts

# re-read hosts file (?)
killall -HUP dnsmasq


You need the usual DNSMasq settings to work as local dns etc.

Cheers
bluzfanmr1
DD-WRT Novice


Joined: 11 Feb 2015
Posts: 36

PostPosted: Tue Jun 07, 2016 16:06    Post subject: Reply with quote
The first script here and the cron works great for me: https://www.dd-wrt.com/wiki/index.php/Ad_blocking

The only thing I change is to have it create the host file on the USB stick mounted as /opt.

_________________
Asus RT-AC66U_B1

***RIP***TRENDnet TEW-811DRU***FRIED***

jcdole
DD-WRT Novice


Joined: 13 Jun 2015
Posts: 42
Location: South-West France

PostPosted: Thu Jul 14, 2016 15:29    Post subject: Reply with quote
Hello.
Seems there is a problem whith one url in the sript gen_host.sh.
The URL "http://jansal.googlecode.com/svn/trunk/adblock/hosts" is no longer usable and I cannot download from the new project which has been exported to GitHub: https://github.com/lewisje/jansal.
Any help is welcome.

_________________
Netgear R6300v2 DD-WRT v3.0-r47495 std (09/28/21) - Linux Opensuse Leap 15.2 - Win 10
ironmanlok
DD-WRT User


Joined: 16 Jul 2012
Posts: 59

PostPosted: Thu Jul 14, 2016 21:14    Post subject: Reply with quote
Sorry guys, didn't notice this thread was updated.

I changed my script a few months ago to interpret http codes and keep trying each URL up to 3 times and then skip to next URL, I just forgot to upload it here.

Also, I just replaced the jansaw list URL to point to github.



gen_host.sh.txt
 Description:

Download
 Filename:  gen_host.sh.txt
 Filesize:  6.6 KB
 Downloaded:  1077 Time(s)

jcdole
DD-WRT Novice


Joined: 13 Jun 2015
Posts: 42
Location: South-West France

PostPosted: Wed Aug 17, 2016 8:19    Post subject: Reply with quote
ironmanlok wrote:
Sorry guys, didn't notice this thread was updated.

I changed my script a few months ago to interpret http codes and keep trying each URL up to 3 times and then skip to next URL, I just forgot to upload it here.

Also, I just replaced the jansaw list URL to point to github.


Seems working.

Thank you very much

_________________
Netgear R6300v2 DD-WRT v3.0-r47495 std (09/28/21) - Linux Opensuse Leap 15.2 - Win 10
ironmanlok
DD-WRT User


Joined: 16 Jul 2012
Posts: 59

PostPosted: Wed Aug 17, 2016 19:25    Post subject: Reply with quote
I'm trying to do an update to download a blocklist of bad ips but can't get it to work right under kernel 4.4. However if you're having trouble with https feeds, either u add -k to curl parameters or install ca-certificates from OPKG.

When I get the ip blocklist working right ill post the new version.
ironmanlok
DD-WRT User


Joined: 16 Jul 2012
Posts: 59

PostPosted: Mon Aug 29, 2016 1:55    Post subject: Reply with quote
This version only runs on Kernel 4.4+ kongac, since it requires OPKG.

I added an IP blocklist based on ideas posted here: http://www.dd-wrt.com/phpBB2/viewtopic.php?t=302653

I'd like some suggestions for bad IPs lists, like exploiters, botnets, spammers, etc.



ipset_setup.sh.txt
 Description:
Auxiliar script for setting firewall rules

Download
 Filename:  ipset_setup.sh.txt
 Filesize:  1.95 KB
 Downloaded:  819 Time(s)


gen_host.sh.txt
 Description:
Main script

Download
 Filename:  gen_host.sh.txt
 Filesize:  10.47 KB
 Downloaded:  1151 Time(s)

162884
DD-WRT User


Joined: 04 Feb 2016
Posts: 106

PostPosted: Sat Nov 19, 2016 1:37    Post subject: Reply with quote
I'm trying to use DD-WRT to block ads. I added this script below to Startup by following the instructions from this link https://www.dd-wrt.com/wiki/index.php/Ad_blocking.

I don't think it's working, how can I test to be sure it is Thanks

#!/bin/sh
logger WAN up script executing
if test -s /tmp/hosts0
then
rm /tmp/hosts0
fi

logger Downloading http://www.mvps.org/winhelp2002/hosts.txt
wget -O - http://www.mvps.org/winhelp2002/hosts.txt | grep 0.0.0.0 |
sed 's/[[:space:]]*#.*$//g;' |
grep -v localhost | tr ' ' '\t' |
tr -s '\t' | tr -d '\015' | sort -u >/tmp/hosts0
grep addn-hosts /tmp/dnsmasq.conf ||
echo "addn-hosts=/tmp/hosts0" >>/tmp/dnsmasq.conf
logger Restarting dnsmasq
killall dnsmasq
dnsmasq --conf-file=/tmp/dnsmasq.conf

_________________
WRT1900ACS
Brainslayer: DD-WRT v3.0-r36247 std (06/29/1Cool
h8red
DD-WRT Guru


Joined: 28 Jun 2011
Posts: 580
Location: Vilnius, Lithuania

PostPosted: Sat Nov 19, 2016 12:14    Post subject: Reply with quote
162884 wrote:
I don't think it's working, how can I test to be sure it is Thanks


Add startup Script:
_rogue=0.0.0.0
echo -e "n=1\nwhile ! wget -q -O /tmp/hsts http://winhelp2002.mvps.org/hosts.txt ; do\n\t[ \$n -gt 5 ] && break\n\tlet n+=1\n\tsleep 60\ndone\ngrep \"^0.0.0.0\" /tmp/hsts | grep \"^0.0.0.0\" | grep -v localhost | awk '{print \"$_rogue\\\t\"\$2}' | tr -d '\\\015' >/tmp/dlhosts\nrm /tmp/hsts\nkillall -HUP dnsmasq" >/tmp/wh
sh /tmp/wh &


Add to Additional DNS Masquerade options:
addn-hosts=/tmp/dlhosts


Add to Additional CronJobs
0 12 * * * root /tmp/.rc_startup

_________________
[Ramips] Nexx WT3020F Openwrt @kernel #4.14.167 (OpenVPN server, Wireguard server, AD blocking, SQM QOS, USB)
162884
DD-WRT User


Joined: 04 Feb 2016
Posts: 106

PostPosted: Sun Nov 20, 2016 1:48    Post subject: Reply with quote
Thanks h8red! This seems to have done the trick. Are the instructions from that page I used out of date? Where did you find these instructions?

Does anyone know if using this method is as effective as using Ad Block or Ad Block Plus Chrome browser plugins? Appreciate it!

_________________
WRT1900ACS
Brainslayer: DD-WRT v3.0-r36247 std (06/29/1Cool
miggalvez
DD-WRT Novice


Joined: 15 Dec 2016
Posts: 19

PostPosted: Thu Dec 15, 2016 16:10    Post subject: Reply with quote
ironmanlok wrote:
Sorry guys, didn't notice this thread was updated.

I changed my script a few months ago to interpret http codes and keep trying each URL up to 3 times and then skip to next URL, I just forgot to upload it here.

Also, I just replaced the jansaw list URL to point to github.


Do I need to enable Local DNS in Services tab for this script to work?
Duxa
DD-WRT User


Joined: 16 Aug 2013
Posts: 191

PostPosted: Thu Dec 15, 2016 21:41    Post subject: Reply with quote
How is this different from the built in Privoxy?
jcdole
DD-WRT Novice


Joined: 13 Jun 2015
Posts: 42
Location: South-West France

PostPosted: Fri Dec 23, 2016 13:52    Post subject: Reply with quote
jcdole wrote:
ironmanlok wrote:
Sorry guys, didn't notice this thread was updated.

I changed my script a few months ago to interpret http codes and keep trying each URL up to 3 times and then skip to next URL, I just forgot to upload it here.

Also, I just replaced the jansaw list URL to point to github.


Seems working.

Thank you very much


There is an error with url :
https://raw.githubusercontent.com/lewisje/jansal/master/adblock/hosts
curl return an error 301.

Trying with wget, get this error :
Code:
Connecting to raw.githubusercontent.com (151.101.120.133:80)
Connecting to raw.githubusercontent.com (151.101.120.133:443)
wget: error getting response: Resource temporarily unavailable


One can see the list using firefox

Any help is welcome.

_________________
Netgear R6300v2 DD-WRT v3.0-r47495 std (09/28/21) - Linux Opensuse Leap 15.2 - Win 10
Goto page Previous  1, 2, 3 ... 11, 12, 13, 14  Next Display posts from previous:    Page 12 of 14
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