AdBlock

Post new topic   Reply to topic    DD-WRT Forum Index -> Atheros WiSOC based Hardware
Goto page 1, 2, 3  Next
Author Message
SuninderSingh
DD-WRT Novice


Joined: 05 Sep 2017
Posts: 28
Location: IN

PostPosted: Sat Feb 24, 2018 7:23    Post subject: AdBlock Reply with quote
Hello,

Can someone suggest, how to block Ad using DD-WRT firmware?

My device details as follow :-

Router Model - TP-Link TL-WR841ND v9
Firmware Version - DD-WRT v3.0-r33772 std (11/16/17)
CPU Model - Qualcomm Atheros QCA9533 ver 1 rev 1.1 (0x0141)

This script i used but its not working :-

Startup Script:
Code:

_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 &


Additional DNSMasq Options:
Code:

addn-hosts=/tmp/dlhosts
address=/facebook.com/0.0.0.0


Additional Cron Jobs:
Code:

0 12 * * * root /tmp/.rc_startup

Thanks
Sponsor
Alozaros
DD-WRT Guru


Joined: 16 Nov 2015
Posts: 6440
Location: UK, London, just across the river..

PostPosted: Sat Feb 24, 2018 7:53    Post subject: Reply with quote
it depends what you want to block...
as well did you turned local DNS as adblocker is based on DNSmasq you have to turn it on too...
this one is very simple but its working well

_________________
Atheros
TP-Link WR740Nv1 ---DD-WRT 55630 WAP
TP-Link WR1043NDv2 -DD-WRT 55723 Gateway/DoT,Forced DNS,Ad-Block,Firewall,x4VLAN,VPN
TP-Link WR1043NDv2 -Gargoyle OS 1.15.x AP,DNS,QoS,Quotas
Qualcomm-Atheros
Netgear XR500 --DD-WRT 55779 Gateway/DoH,Forced DNS,AP Isolation,4VLAN,Ad-Block,Firewall,Vanilla
Netgear R7800 --DD-WRT 55819 Gateway/DoT,AD-Block,Forced DNS,AP&Net Isolation,x3VLAN,Firewall,Vanilla
Netgear R9000 --DD-WRT 55779 Gateway/DoT,AD-Block,AP Isolation,Firewall,Forced DNS,x2VLAN,Vanilla
Broadcom
Netgear R7000 --DD-WRT 55460 Gateway/SmartDNS/DoH,AD-Block,Firewall,Forced DNS,x3VLAN,VPN
NOT USING 5Ghz ANYWHERE
------------------------------------------------------
Stubby DNS over TLS I DNSCrypt v2 by mac913
videobruce
DD-WRT User


Joined: 22 Aug 2009
Posts: 267
Location: New York State

PostPosted: Sat Feb 24, 2018 22:47    Post subject: Reply with quote
How is this any different than running a extension in your browser with the same or similar function??
Alozaros
DD-WRT Guru


Joined: 16 Nov 2015
Posts: 6440
Location: UK, London, just across the river..

PostPosted: Sat Feb 24, 2018 23:11    Post subject: Reply with quote
well...its close to mind that it runs on router level so it blocks those sites for everyone connected to it....otherwise not much difference...
_________________
Atheros
TP-Link WR740Nv1 ---DD-WRT 55630 WAP
TP-Link WR1043NDv2 -DD-WRT 55723 Gateway/DoT,Forced DNS,Ad-Block,Firewall,x4VLAN,VPN
TP-Link WR1043NDv2 -Gargoyle OS 1.15.x AP,DNS,QoS,Quotas
Qualcomm-Atheros
Netgear XR500 --DD-WRT 55779 Gateway/DoH,Forced DNS,AP Isolation,4VLAN,Ad-Block,Firewall,Vanilla
Netgear R7800 --DD-WRT 55819 Gateway/DoT,AD-Block,Forced DNS,AP&Net Isolation,x3VLAN,Firewall,Vanilla
Netgear R9000 --DD-WRT 55779 Gateway/DoT,AD-Block,AP Isolation,Firewall,Forced DNS,x2VLAN,Vanilla
Broadcom
Netgear R7000 --DD-WRT 55460 Gateway/SmartDNS/DoH,AD-Block,Firewall,Forced DNS,x3VLAN,VPN
NOT USING 5Ghz ANYWHERE
------------------------------------------------------
Stubby DNS over TLS I DNSCrypt v2 by mac913
Xeon2k8
DD-WRT Guru


Joined: 11 Feb 2016
Posts: 1288

PostPosted: Sun Feb 25, 2018 19:36    Post subject: Reply with quote
From what I see that script creates several files uselessly. I use this one much simpler, no additional configs needed in dnsmasq:
Code:

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

logger Downloading StevenBlack hosts file
curl -k https://raw.githubusercontent.com/StevenBlack/hosts/master/hosts | 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 -u root -g root --conf-file=/tmp/dnsmasq.conf

Use the hosts file url of your preference. And as Alozaros said enable Local DNS.

_________________
R6400v2 (boardID:30) - Kong 36480 running since 03/09/18 - (AP - DNSMasq - AdBlocking - QoS)
R7800 - BS 31924 running since 05/26/17 - (AP - OpenVPN Client - DNSMasq - AdBlocking - QoS)
R7000 - BS 30771 running since 12/16/16 - (AP - NAS - FTP - SMB - OpenVPN Server - Transmission - DDNS - DNSMasq - AdBlocking - QoS)
R6250 - BS 29193 running since 03/20/16 - (AP - NAS - FTP - SMB - DNSMasq - AdBlocking)


Last edited by Xeon2k8 on Mon Feb 26, 2018 23:30; edited 1 time in total
Alozaros
DD-WRT Guru


Joined: 16 Nov 2015
Posts: 6440
Location: UK, London, just across the river..

PostPosted: Sun Feb 25, 2018 22:31    Post subject: Reply with quote
Xeon2k8 do you have a cron job, i ve been using even shorter script but yes it has additional DNSmasq options as well cron job...

i was also thinking would it be possible to add your curl command to it or it will be a mess

sleep 20
wget -qO- http://www.mvps.org/winhelp2002/hosts.txt|grep "^0.0.0.0" >> /tmp/hosts
curl -k https://raw.githubusercontent.com/StevenBlack/hosts/master/hosts|grep "^0.0.0.0" >> /tmp/hosts
killall -HUP dnsmasq

P.S hmmm Xeon2k8 it seems the script you posted works but not blocking most of the adverts like http://www.mvps.org/winhelp2002/hosts.txt do especially on those sites im used to ...

_________________
Atheros
TP-Link WR740Nv1 ---DD-WRT 55630 WAP
TP-Link WR1043NDv2 -DD-WRT 55723 Gateway/DoT,Forced DNS,Ad-Block,Firewall,x4VLAN,VPN
TP-Link WR1043NDv2 -Gargoyle OS 1.15.x AP,DNS,QoS,Quotas
Qualcomm-Atheros
Netgear XR500 --DD-WRT 55779 Gateway/DoH,Forced DNS,AP Isolation,4VLAN,Ad-Block,Firewall,Vanilla
Netgear R7800 --DD-WRT 55819 Gateway/DoT,AD-Block,Forced DNS,AP&Net Isolation,x3VLAN,Firewall,Vanilla
Netgear R9000 --DD-WRT 55779 Gateway/DoT,AD-Block,AP Isolation,Firewall,Forced DNS,x2VLAN,Vanilla
Broadcom
Netgear R7000 --DD-WRT 55460 Gateway/SmartDNS/DoH,AD-Block,Firewall,Forced DNS,x3VLAN,VPN
NOT USING 5Ghz ANYWHERE
------------------------------------------------------
Stubby DNS over TLS I DNSCrypt v2 by mac913
labo
DD-WRT Guru


Joined: 30 Jan 2015
Posts: 676
Location: Texas, USA

PostPosted: Mon Feb 26, 2018 4:49    Post subject: Reply with quote
What you guys think about the solution put-up by Yamaraj ?

https://www.dd-wrt.com/phpBB2/viewtopic.php?t=307533

I'm using that in Blitz mode quite effective and less aggressive.

_________________
ASUS GT-BE98 PRO Main: Fiber 5gbps up/down
ASUS AXE16000: AI Mesh node
2 X ASUS RT-AX89X: AI Mesh nodes
QNAP QSW-1208-8C 12-Port 10GbE Switch
XS712T ProSafe 12-Port 10GbE Switch
3 X R9000 DD-WRT Mesh
Alozaros
DD-WRT Guru


Joined: 16 Nov 2015
Posts: 6440
Location: UK, London, just across the river..

PostPosted: Mon Feb 26, 2018 8:18    Post subject: Reply with quote
labo wrote:
What you guys think about the solution put-up by Yamaraj ?

https://www.dd-wrt.com/phpBB2/viewtopic.php?t=307533

I'm using that in Blitz mode quite effective and less aggressive.


well the first script is less aggressive than this one you offer Yamaraj script is very very scatchy and relays on jffs
i prefer to stay away from using jffs

_________________
Atheros
TP-Link WR740Nv1 ---DD-WRT 55630 WAP
TP-Link WR1043NDv2 -DD-WRT 55723 Gateway/DoT,Forced DNS,Ad-Block,Firewall,x4VLAN,VPN
TP-Link WR1043NDv2 -Gargoyle OS 1.15.x AP,DNS,QoS,Quotas
Qualcomm-Atheros
Netgear XR500 --DD-WRT 55779 Gateway/DoH,Forced DNS,AP Isolation,4VLAN,Ad-Block,Firewall,Vanilla
Netgear R7800 --DD-WRT 55819 Gateway/DoT,AD-Block,Forced DNS,AP&Net Isolation,x3VLAN,Firewall,Vanilla
Netgear R9000 --DD-WRT 55779 Gateway/DoT,AD-Block,AP Isolation,Firewall,Forced DNS,x2VLAN,Vanilla
Broadcom
Netgear R7000 --DD-WRT 55460 Gateway/SmartDNS/DoH,AD-Block,Firewall,Forced DNS,x3VLAN,VPN
NOT USING 5Ghz ANYWHERE
------------------------------------------------------
Stubby DNS over TLS I DNSCrypt v2 by mac913
labo
DD-WRT Guru


Joined: 30 Jan 2015
Posts: 676
Location: Texas, USA

PostPosted: Mon Feb 26, 2018 9:36    Post subject: Reply with quote
Alozaros wrote:

i prefer to stay away from using jffs


Just curious, what are the concerns using jffs ?
I did have an issue with jiffs recently on my R7800 and forced to erase after corruption.
Anything else to be worried ?

_________________
ASUS GT-BE98 PRO Main: Fiber 5gbps up/down
ASUS AXE16000: AI Mesh node
2 X ASUS RT-AX89X: AI Mesh nodes
QNAP QSW-1208-8C 12-Port 10GbE Switch
XS712T ProSafe 12-Port 10GbE Switch
3 X R9000 DD-WRT Mesh
Alozaros
DD-WRT Guru


Joined: 16 Nov 2015
Posts: 6440
Location: UK, London, just across the river..

PostPosted: Mon Feb 26, 2018 17:23    Post subject: Reply with quote
labo wrote:
Alozaros wrote:

i prefer to stay away from using jffs


Just curious, what are the concerns using jffs ?
I did have an issue with jiffs recently on my R7800 and forced to erase after corruption.
Anything else to be worried ?


last few builds have problems with jffs also i find it too engaging just a simple script and temp files produce my results Wink i run 2 different scripts on my units both are working well for my needs but i wouldn't mind to improve if its a simple way with not much set up Razz Razz

_________________
Atheros
TP-Link WR740Nv1 ---DD-WRT 55630 WAP
TP-Link WR1043NDv2 -DD-WRT 55723 Gateway/DoT,Forced DNS,Ad-Block,Firewall,x4VLAN,VPN
TP-Link WR1043NDv2 -Gargoyle OS 1.15.x AP,DNS,QoS,Quotas
Qualcomm-Atheros
Netgear XR500 --DD-WRT 55779 Gateway/DoH,Forced DNS,AP Isolation,4VLAN,Ad-Block,Firewall,Vanilla
Netgear R7800 --DD-WRT 55819 Gateway/DoT,AD-Block,Forced DNS,AP&Net Isolation,x3VLAN,Firewall,Vanilla
Netgear R9000 --DD-WRT 55779 Gateway/DoT,AD-Block,AP Isolation,Firewall,Forced DNS,x2VLAN,Vanilla
Broadcom
Netgear R7000 --DD-WRT 55460 Gateway/SmartDNS/DoH,AD-Block,Firewall,Forced DNS,x3VLAN,VPN
NOT USING 5Ghz ANYWHERE
------------------------------------------------------
Stubby DNS over TLS I DNSCrypt v2 by mac913
Alozaros
DD-WRT Guru


Joined: 16 Nov 2015
Posts: 6440
Location: UK, London, just across the river..

PostPosted: Mon Feb 26, 2018 17:47    Post subject: Reply with quote
wget -qO /tmp/addhosts http://szojox.ugu.pl/hosts
wget -qO /tmp/jansal http://jansal.googlecode.com/svn/trunk/adblock/hosts
wget -qO /tmp/malwaredomain http://www.malwaredomainlist.com/hostslist/hosts.txt
stopservice dnsmasq && startservice dnsmasq

Under Setup/Services/DNSMasq/Additional DNSMasq Options:

addn-hosts=/tmp/addhosts
addn-hosts=/tmp/jansal
addn-hosts=/tmp/malwaredomain

Uses less than 40K of memory.

here is another script with more than one hosts just have to edit those links as not all are working ill give it a try as i found it in old article ...
https://www.dd-wrt.com/phpBB2/viewtopic.php?t=277407&hightlight=blocking+script

more hosts sources
http://someonewhocares.org/hosts/zero/hosts
http://www.hostsfile.org/Downloads/hosts.txt
http://www.hosts-file.net/download/hosts.txt

P.S. finally i got this up and running

save start up script:

wget -qO /tmp/mvps http://winhelp2002.mvps.org/hosts.txt
wget -qO /tmp/someonewhocares http://someonewhocares.org/hosts/zero/hosts
killall -HUP dnsmasq
stopservice dnsmasq && startservice dnsmasq

additional DNSmasq options:
addn-hosts=/tmp/mvps
addn-hosts=/tmp/someonewhocares

cron job
0 12 * * * root /tmp/.rc_startup

i cant only see if DNSmasq D/L and adds the second link but its working so far...

_________________
Atheros
TP-Link WR740Nv1 ---DD-WRT 55630 WAP
TP-Link WR1043NDv2 -DD-WRT 55723 Gateway/DoT,Forced DNS,Ad-Block,Firewall,x4VLAN,VPN
TP-Link WR1043NDv2 -Gargoyle OS 1.15.x AP,DNS,QoS,Quotas
Qualcomm-Atheros
Netgear XR500 --DD-WRT 55779 Gateway/DoH,Forced DNS,AP Isolation,4VLAN,Ad-Block,Firewall,Vanilla
Netgear R7800 --DD-WRT 55819 Gateway/DoT,AD-Block,Forced DNS,AP&Net Isolation,x3VLAN,Firewall,Vanilla
Netgear R9000 --DD-WRT 55779 Gateway/DoT,AD-Block,AP Isolation,Firewall,Forced DNS,x2VLAN,Vanilla
Broadcom
Netgear R7000 --DD-WRT 55460 Gateway/SmartDNS/DoH,AD-Block,Firewall,Forced DNS,x3VLAN,VPN
NOT USING 5Ghz ANYWHERE
------------------------------------------------------
Stubby DNS over TLS I DNSCrypt v2 by mac913
Xeon2k8
DD-WRT Guru


Joined: 11 Feb 2016
Posts: 1288

PostPosted: Mon Feb 26, 2018 22:23    Post subject: Reply with quote
Alozaros wrote:

....
P.S hmmm Xeon2k8 it seems the script you posted works but not blocking most of the adverts like http://www.mvps.org/winhelp2002/hosts.txt do especially on those sites im used to ...


Xeon2k8 wrote:

Use the hosts file url of your preference.

You must have done something wrong:
https://github.com/StevenBlack/hosts

It's included already, along with a lot more other hosts file sources.

Yeah I have also the cron job setup, but no additional dnsmasq configs. I agree on the jffs subject, prefer using just tmp folder.

Also what I did was detach it from startup since I don't want startup script executing all the time on cron. That way I can add all things I want in startup without having to remember that it's also being run on the cron on a daily basis. Like this:

Startup script:
{for loop from tatsuya86 for governors}

/tmp/custom.sh

Cron job:
0 12 * * * root /tmp/custom.sh

And the adblock script is saved in custom script.

_________________
R6400v2 (boardID:30) - Kong 36480 running since 03/09/18 - (AP - DNSMasq - AdBlocking - QoS)
R7800 - BS 31924 running since 05/26/17 - (AP - OpenVPN Client - DNSMasq - AdBlocking - QoS)
R7000 - BS 30771 running since 12/16/16 - (AP - NAS - FTP - SMB - OpenVPN Server - Transmission - DDNS - DNSMasq - AdBlocking - QoS)
R6250 - BS 29193 running since 03/20/16 - (AP - NAS - FTP - SMB - DNSMasq - AdBlocking)
SuninderSingh
DD-WRT Novice


Joined: 05 Sep 2017
Posts: 28
Location: IN

PostPosted: Mon Mar 05, 2018 14:09    Post subject: Reply with quote
Hi,

Sorry for late reply, i used your script and saved as startup script. After i reboot my router, and same result. curl command not found.

Here its still showing ads. https://ads-blocker.com/testing/

Sad

Xeon2k8 wrote:
From what I see that script creates several files uselessly. I use this one much simpler, no additional configs needed in dnsmasq:
Code:

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

logger Downloading StevenBlack hosts file
curl -k https://raw.githubusercontent.com/StevenBlack/hosts/master/hosts | 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 -u root -g root --conf-file=/tmp/dnsmasq.conf

Use the hosts file url of your preference. And as Alozaros said enable Local DNS.
SuninderSingh
DD-WRT Novice


Joined: 05 Sep 2017
Posts: 28
Location: IN

PostPosted: Mon Mar 05, 2018 14:27    Post subject: Reply with quote
Hi,

sorry for late reply, your script is working but partially. It auto create "/tmp/someonewhocares" but failed to create "/tmp/mvps" so i manually run the download command.

Good thing is it test successfully and block ads https://ads-blocker.com/testing/

Thank you Smile

"
P.S. finally i got this up and running
save start up script:

wget -qO /tmp/mvps http://winhelp2002.mvps.org/hosts.txt
wget -qO /tmp/someonewhocares http://someonewhocares.org/hosts/zero/hosts
killall -HUP dnsmasq
stopservice dnsmasq && startservice dnsmasq

additional DNSmasq options:
addn-hosts=/tmp/mvps
addn-hosts=/tmp/someonewhocares

cron job
0 12 * * * root /tmp/.rc_startup

"


Alozaros wrote:
wget -qO /tmp/addhosts http://szojox.ugu.pl/hosts
wget -qO /tmp/jansal http://jansal.googlecode.com/svn/trunk/adblock/hosts
wget -qO /tmp/malwaredomain http://www.malwaredomainlist.com/hostslist/hosts.txt
stopservice dnsmasq && startservice dnsmasq

Under Setup/Services/DNSMasq/Additional DNSMasq Options:

addn-hosts=/tmp/addhosts
addn-hosts=/tmp/jansal
addn-hosts=/tmp/malwaredomain

Uses less than 40K of memory.

here is another script with more than one hosts just have to edit those links as not all are working ill give it a try as i found it in old article ...
https://www.dd-wrt.com/phpBB2/viewtopic.php?t=277407&hightlight=blocking+script

more hosts sources
http://someonewhocares.org/hosts/zero/hosts
http://www.hostsfile.org/Downloads/hosts.txt
http://www.hosts-file.net/download/hosts.txt

P.S. finally i got this up and running

save start up script:

wget -qO /tmp/mvps http://winhelp2002.mvps.org/hosts.txt
wget -qO /tmp/someonewhocares http://someonewhocares.org/hosts/zero/hosts
killall -HUP dnsmasq
stopservice dnsmasq && startservice dnsmasq

additional DNSmasq options:
addn-hosts=/tmp/mvps
addn-hosts=/tmp/someonewhocares

cron job
0 12 * * * root /tmp/.rc_startup

i cant only see if DNSmasq D/L and adds the second link but its working so far...
dr4v3n
DD-WRT Novice


Joined: 27 Apr 2018
Posts: 1

PostPosted: Fri Apr 27, 2018 14:59    Post subject: Reply with quote
Xeon2k8 wrote:
From what I see that script creates several files uselessly. I use this one much simpler, no additional configs needed in dnsmasq:
Code:

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

logger Downloading StevenBlack hosts file
curl -k https://raw.githubusercontent.com/StevenBlack/hosts/master/hosts | 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 -u root -g root --conf-file=/tmp/dnsmasq.conf

Use the hosts file url of your preference. And as Alozaros said enable Local DNS.

Hello,

Sorry for the noob question but where should i put the script?
Should I add a cron job?
Goto page 1, 2, 3  Next Display posts from previous:    Page 1 of 3
Post new topic   Reply to topic    DD-WRT Forum Index -> Atheros WiSOC 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 cannot attach files in this forum
You cannot download files in this forum