Changing Ad Block Source

Post new topic   Reply to topic    DD-WRT Forum Index -> Marvell MVEBU based Hardware (WRT1900AC etc.)
Author Message
kennethhsu
DD-WRT Novice


Joined: 06 Nov 2015
Posts: 4

PostPosted: Tue Jun 28, 2016 14:28    Post subject: Changing Ad Block Source Reply with quote
Sorry if this has already been answered or is posted on the wrong forum.

Hello everyone, I just spend the whole last night reading about dd-wrt and how to enable network wide adblocks. I am following the instructions here https://www.dd-wrt.com/wiki/index.php/Ad_blocking , and using method 1:

Code:

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


However, I do not like the filter that is being used, as I found many ads leaking through. I would prefer to use this ( https://raw.githubusercontent.com/StevenBlack/hosts/master/hosts ) instead. but I think wget is being used and it must be a downloadable text file?

I will also add that my adblock is working (with the original host file, it's just too many ads leak through). So if I understand correctly, I just need to figure out the syntex to convert the host file I want to a txt file so wget can pull it.

I tried to add .txt at the end of the new link, but obviously that did not work. Can anyone help me? Thanks in advance.


Last edited by kennethhsu on Tue Jun 28, 2016 15:49; edited 1 time in total
Sponsor
cybrnook
DD-WRT User


Joined: 08 Jan 2014
Posts: 279

PostPosted: Tue Jun 28, 2016 15:40    Post subject: Reply with quote
In the command you listed above, the parsing of the file is extension agnostic.

To that matter, it doesn't care what the name is, as it's instantly strung into a grep command.

So you could likely just replace the url with your url file of choice, and it should work.

SO:
wget -O - https://raw.githubusercontent.com/StevenBlack/hosts/master/hosts | grep 0.0.0.0 |


and FYI, the link you added to the guide seems to go nowhere.
kennethhsu
DD-WRT Novice


Joined: 06 Nov 2015
Posts: 4

PostPosted: Tue Jun 28, 2016 15:50    Post subject: Reply with quote
Thank you for your reply.

I fixed the link.

I also tried what you suggested, but it doesn't seem to work. Can you possibly know why? How can I try to debug what is going wrong?
cybrnook
DD-WRT User


Joined: 08 Jan 2014
Posts: 279

PostPosted: Tue Jun 28, 2016 17:27    Post subject: Reply with quote
hmmm, I wonder if its because its an https url, and wget is failing? Maybe using curl instead could work.

Another option is to download the file manually and just staging it when you run the update.

So something like:

instead of:
wget -O - https://raw.githubusercontent.com/StevenBlack/hosts/master/hosts | grep 0.0.0.0 |

You could:

/path/to/downloaded/file/hosts | grep 0.0.0.0 |

That could work, at least for the initial implementation. Every subsequent update would need to be done manually like this.


Hmm, try this first:

curl -O https://raw.githubusercontent.com/StevenBlack/hosts/master/hosts | grep 0.0.0.0 |

might need the "-" between O and https, not sure
kennethhsu
DD-WRT Novice


Joined: 06 Nov 2015
Posts: 4

PostPosted: Tue Jun 28, 2016 21:42    Post subject: Reply with quote
still not working...

so I really think the problem is the httpS... not really sure how to get by that, it works fine on my command line, but when I put it in the router, it won't work
Krause
DD-WRT Novice


Joined: 03 Jun 2013
Posts: 21

PostPosted: Fri Jul 01, 2016 15:38    Post subject: Reply with quote
Maybe this will be of some help, but on that guys github comments here https://github.com/StevenBlack/hosts/issues/47 at the bottom someone called stordoff said that it works great on their ddwrt router and he even gives the code he uses:

Startup script:
Code:
wget -qO /tmp/ad-hosts-v4 https://raw.githubusercontent.com/StevenBlack/hosts/master/hosts

H_MERGE=/tmp/ad-hosts
H_ORIG=/tmp/ad-hosts-v4

sort $H_ORIG | uniq | grep "^0" >> $H_MERGE
sort $H_ORIG | uniq | grep "^0" | sed "s/0\.0\.0\.0/::/g" >> $H_MERGE
stopservice dnsmasq && startservice dnsmasq


Additional DNSmasq options:
Code:
addn-hosts=/tmp/ad-hosts



Might be worth a shot
kennethhsu
DD-WRT Novice


Joined: 06 Nov 2015
Posts: 4

PostPosted: Sat Sep 30, 2017 2:34    Post subject: Reply with quote
FYI, the following works:

Code:
curl -k -o /tmp/ad-hosts https://raw.githubusercontent.com/StevenBlack/hosts/master/hosts

stopservice dnsmasq && startservice dnsmasq


and DNSmasq
Code:
addn-hosts=/tmp/ad-hosts
ryanmusante
DD-WRT Novice


Joined: 28 Sep 2016
Posts: 2

PostPosted: Tue Oct 03, 2017 5:40    Post subject: Reply with quote
Does this tax the CPU on the router much?

Do you disable ad blockers within your web browsers on the clients?

How do you find this works compared to having it disabled and using only built in blockers within your applications?
NashBlade
DD-WRT Novice


Joined: 01 Aug 2012
Posts: 26

PostPosted: Wed Oct 04, 2017 22:56    Post subject: Reply with quote
An easy way to test is to use a browser on a phone to visit one of the blocked addresses. I don't disable the adblockers on my desktop clients.

I suspect that modern routers have powerful CPU's (over 1GHz) that can handle VPN connections at high speeds, so DNS lookups in a host file can't be taxing.
rudderlessrone
DD-WRT Novice


Joined: 16 Nov 2017
Posts: 1

PostPosted: Thu Nov 16, 2017 8:14    Post subject: Reply with quote
kennethhsu wrote:
FYI, the following works:

Code:
curl -k -o /tmp/ad-hosts https://raw.githubusercontent.com/StevenBlack/hosts/master/hosts

stopservice dnsmasq && startservice dnsmasq


and DNSmasq
Code:
addn-hosts=/tmp/ad-hosts


For the love of all that is holy, I cannot get this to work.

With reference to the tutorial here https://www.dd-wrt.com/wiki/index.php/Ad_blocking, where am I substituting this new code in the startup script? Or is it complete replacement code? What should my startup script look like using the above? Are there any modifications I need to make to the Firewall script?

Any help is very much appreciated.
Display posts from previous:    Page 1 of 1
Post new topic   Reply to topic    DD-WRT Forum Index -> Marvell MVEBU based Hardware (WRT1900AC etc.) 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 cannot attach files in this forum
You cannot download files in this forum