Adblock for DD-WRT (version 2)

Post new topic   Reply to topic    DD-WRT Forum Index -> General Questions
Goto page Previous  1, 2, 3 ... 16, 17, 18 ... 21, 22, 23  Next
Author Message
701b84b9ff
DD-WRT Novice


Joined: 03 Apr 2019
Posts: 5

PostPosted: Wed Apr 03, 2019 18:13    Post subject: Reply with quote
I think I have this working, but not sure. How are you guys verifying that it is actually blocking ads correctly?

detectadblock.com says I'm not blocking ads...
Sponsor
0Legolas0
DD-WRT Novice


Joined: 14 Jan 2018
Posts: 16

PostPosted: Sat May 04, 2019 18:05    Post subject: Reply with quote
701b84b9ff wrote:
I think I have this working, but not sure. How are you guys verifying that it is actually blocking ads correctly?

detectadblock.com says I'm not blocking ads...


Do you see ads, and/or reduction in ads?
jdc4429
DD-WRT Novice


Joined: 19 Jun 2019
Posts: 1

PostPosted: Wed Jun 19, 2019 20:34    Post subject: Using Ad Blocking with OpenVPN client Reply with quote
Hello All,

I am attempting to add Ad blocking to my dd-wrt router. I currently have it configured to connect to my VPN provider using the OpenVPN client.

I see where some options need to be turned on that I have off for my OpenVPN configuration and I think enabling the DNS or DNSMasq (which is required for this?) may break the OpenVPN client. I saw another post where it appears you need to setup another DNS service to handle this in order to not break the OpenVPN?

Could someone please explain how this needs to be configured to work in conjunction with the OpenVPN client please. Thank you in advance for any help.


Regards,

Jeff
cdrkeen
DD-WRT Novice


Joined: 27 Jun 2019
Posts: 10

PostPosted: Thu Jun 27, 2019 10:05    Post subject: Reply with quote
I'm unable to update or install Steam Games after installing this script.

I've added both steamcontent.com and steampowered.com, but it still doesn't work.

I've connected my computer directly to my modem and it works just fine.

Is there a possibility that this hostfile is blocking Steam? because when plugged into the router i have to connect multiple times to get my account to login.
Yamaraj
DD-WRT User


Joined: 25 Jan 2017
Posts: 110

PostPosted: Tue Nov 19, 2019 17:10    Post subject: Reply with quote
POINT RELEASE: 20191119 LATEST
1. Cleaned up adblock lists.

How to update if you are on 20180315 or later:
SSH into router
cd /jffs/dnsmasq
./adbhostgen.sh -u

If you are still using an older version, download https://raw.githubusercontent.com/m-parashar/adbhostgen/master/adbhostgen.sh into /jffs/dnsmasq and chmod +x it before executing.

File bug reports, dead links, format errors.

Next up: code cleanup. Soon as I can.

_________________

Routers
NETGEAR R7800 x2: DD-WRT v3.0-r42847 std (04/06/20)
NETGEAR R8500: DD-WRT v3.0-r41517 std (11/11/19)

Scripts
Adblock.sh on DD-WRT (v2) -- Github | Website
Ad-blocking on DD-WRT (v1) -- Github
Rickz
DD-WRT Novice


Joined: 01 Jan 2020
Posts: 35

PostPosted: Thu Jan 02, 2020 4:03    Post subject: Reply with quote
Regards,

does actually this method block youtube ads like ublock origin addon does ??
john_matrix
DD-WRT Novice


Joined: 26 Jan 2014
Posts: 1

PostPosted: Thu Jan 16, 2020 22:10    Post subject: Reply with quote
Hello,

Thank you for your awesome script, it works flawlessly!
If dd-wrt team could integrate it directly on dd-wrt, it could be awesome Smile

One thing, I would like to cron the update with the -s2 parameter, but when I set it the update failed.
How can I do that?
Should I use quotes to integrate the parameter in cron line?

Many thanks in advance!
underdose
DD-WRT Novice


Joined: 12 Jun 2019
Posts: 20

PostPosted: Fri Jan 17, 2020 13:20    Post subject: Reply with quote
Rickz wrote:
Regards,

does actually this method block youtube ads like ublock origin addon does ??


None of the blockers running on routers (this ad-blocking script, Diversion on Asus-Merlin, Pi-Hole etc.) can block YouTube ads since both the video and the ad are served from the same domain and those scripts can't recognize which is which. You need to keep using a browser extension to be able to block YouTube video ads.
maciejrm
DD-WRT Novice


Joined: 29 Jan 2020
Posts: 1

PostPosted: Wed Jan 29, 2020 15:29    Post subject: Reply with quote
Hi,

I was trying to install this script on my WDR4300, and finally got it working, but it seems script is not finding any hosts/domains.

Code:
======================================================
|                adbhostgen for DD-WRT               |
|      https://github.com/m-parashar/adbhostgen      |
|           Copyright 2020 Manish Parashar           |
======================================================
Wed Jan 29 16:07:18 UTC 2020
# VERSION: 20200110
# NETWORK: UP | MODE: ONLINE
# IP ADDRESS FOR ADS: 0.1.2.3
# SECURE [0=NO | 1=YES]: 0
# BLITZ LEVEL [0|1|2|3]: 1
# Creating mpdomains file
# Creating mphosts file
> Processing StevenBlack lists
> Processing notracking blocklists
> Processing Disconnect.me lists
> Processing quidsup/notrack lists
> Processing MalwareDomains lists
> Processing adaway list
# Unlocking BLITZ=1 level lists
> Processing more StevenBlack lists
> Processing hosts-file ATS/EXP/GRM lists
> Processing hosts-file HJK/PUP lists
> Processing dshield lists
> Processing pgl.yoyo.org list
> Processing Securemecca list
> Processing cryptomining and porn lists
> Processing Easylist & w3kbl lists
> Updating official blacklist/whitelist files
# Size of /tmp/mphosts.tmp: 116.0K
# Size of /tmp/mpdomains.tmp: 16.0K
> Processing blacklist/whitelist files
> Processing final mphosts/mpdomains files
> Removing temporary files
[b]# Size of /jffs/dnsmasq/mphosts: 0
# Size of /jffs/dnsmasq/mpdomains: 0[/b]
# Number of ad hosts blocked: approx 0
# Number of ad domains blocked: approx 0
> Restarting DNS server (dnsmasq)
# Total time: 1:9 minutes
# DONE


As You can see I'm getting 0 hosts/domains, I was trying to change BLITZ level but still the same, also trying to add my local Easylist.

I've checked tmporary files, and hosts/domains contains only '-' symbols.
Looks like there is problem with parsing lists when those are parsed using scipt.
I was trying to execute manually for example
Code:
curl -f -s -k https://raw.githubusercontent.com/Perflyst/PiHoleBlocklist/master/android-tracking.txt | grep -o '^[^#]*' | grep -vF -e \"::\" -e \";\" -e \"//\" -e \"http\" -e \"https\" -e \"@\" -e \"mailto\" | tr -cd '\000-\177'

and getting list of domains, but when script does the same I'm getting only '-'...

I was also trying to execute following commands in commandline

Code:
root@mhome:/jffs/dnsmasq# alias MPGETSSL="curl -f -s -k"                                                                                                                                                                                     root@mhome:/jffs/dnsmasq# alias GREPFILTER="grep -o '^[^#]*' | grep -vF -e \"::\" -e \";\" -e \"//\" -e \"http\" -e \"https\" -e \"@\" -e \"mailto\" | tr -cd '\000-\177'"                                                                   root@mhome:/jffs/dnsmasq#                                                                                                                                                                                                                    root@mhome:/jffs/dnsmasq# MPGETSSL https://raw.githubusercontent.com/MajkiIT/polish-ads-filter/master/adblock_social_filters/adblock_social_list.txt | GREPFILTER                                                                            ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------root@mhome:/jffs/dnsmasq#


while when I'm executing following

Code:

root@mhome:/jffs/dnsmasq# curl -f -s -k https://raw.githubusercontent.com/MajkiIT/polish-ads-filter/master/adblock_social_filters/adblock_social_list.txt | grep -o '^[^#]*' | grep -vF -e \"::\" -e \";\" -e \"//\" -e \"http\" -e \"https\" -e \"@\" -e \"mailto\" | tr -cd '\000-\177' [Adblock Plus 2.0] ! Title: Polskie Filtry Spo eczno ciowe ! Polish Social Filters ! Codename: ! Description: Filtry ukrywaj ce i blokuj ce elementy sieci spo eczno ciowych, tj. widgety, wyskakuj ce okienka i inne elementy spo eczno ciowe. ! Required: Do poprawnego dzia ania wymagana jest lista Fanboy's Social Blocking List! ! Collaborators: MajkiIT, blocker999, hawkeye116477, xxcriticxx, KonoromiHimaries, RikoDEV, krystian3w ! Homepage: https://www.certyficate.it/ ! Version: 2020.1.27.2 ! Last modified: Mon, 27 Jan 2020, 21:11 UTC+01 ! Expires: 2 days ! Support: ! GitHub => https://github.com/MajkiIT/polish-ads-filter/issues ! Discord => https://discord.me/polskiefiltry ! Redundant Checker => https://www.certyficate.it/redundant_checker/redundantRuleChecker.html ! License: CC BY-NC-SA 4.0 (https://creativecommons.org/licenses/by-nc-sa/4.0) ! Copyright 2020 Certyficate IT & Polish Filters Team ! Najnowsza wersja zawsze na: https://www.certyficate.it/adblock/ ! v.2020.1.27.2 aktualizacja: pon, 27 sty 2020, 21:11 UTC+01 ! ! ! Popupy akwarysta.eu,dobrewychowanie.pl,pinka.pl
babymanager.pl
beskidy.news
black-friday.pl,cryptoprofit.pl,e-przepisykulinarne.pl,funfashion.pl,kucharenka.pl,kuchniawedwoje.pl,magazyninformacyjny.pl,tele-wizja.ru,wielkopolskamagazyn.pl,zatrzymujacczas.pl
chrzescijanin.pl
dziennik-polityczny.com
ebizpro.pl
eitalia.pl
(...)


what could be the source of the issue?

Many thanks and regards!
Alozaros
DD-WRT Guru


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

PostPosted: Wed Jan 29, 2020 17:08    Post subject: Reply with quote
never seen that script and i doubt it will execute...
also curl is not present on all routers and need to be installed via opt...
last thing if you D/L all those lines, from all those sources, you have to sed/sort them and erase the duplicates, otherwise you will be out of ram...
there are good ad-blocking scripts, that are confirmed as working and used from DDWRT community, just look around...

_________________
Atheros
TP-Link WR740Nv1 ---DD-WRT 55179 WAP
TP-Link WR1043NDv2 -DD-WRT 55303 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 55460 Gateway/DoH,Forced DNS,AP Isolation,4VLAN,Ad-Block,Firewall,Vanilla
Netgear R7800 --DD-WRT 55460 Gateway/DoT,AD-Block,Forced DNS,AP&Net Isolation,x3VLAN,Firewall,Vanilla
Netgear R9000 --DD-WRT 55363 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
Yamaraj
DD-WRT User


Joined: 25 Jan 2017
Posts: 110

PostPosted: Thu Jan 30, 2020 9:46    Post subject: Reply with quote
john_matrix wrote:
Hello,

Thank you for your awesome script, it works flawlessly!
If dd-wrt team could integrate it directly on dd-wrt, it could be awesome :)

One thing, I would like to cron the update with the -s2 parameter, but when I set it the update failed.
How can I do that?
Should I use quotes to integrate the parameter in cron line?

Many thanks in advance!


Code:
0 6 * * 4 root /jffs/dnsmasq/adblock.sh -s2


Works perfectly fine on my test routers. Update to the latest version (read below) and check the log file for command line parameters, as well as errors.

_________________

Routers
NETGEAR R7800 x2: DD-WRT v3.0-r42847 std (04/06/20)
NETGEAR R8500: DD-WRT v3.0-r41517 std (11/11/19)

Scripts
Adblock.sh on DD-WRT (v2) -- Github | Website
Ad-blocking on DD-WRT (v1) -- Github
Yamaraj
DD-WRT User


Joined: 25 Jan 2017
Posts: 110

PostPosted: Thu Jan 30, 2020 9:53    Post subject: Reply with quote
Alozaros wrote:
never seen that script and i doubt it will execute...

Your doubts are irrelevant as this script has been executing on my routers successfully for the past 3+ years. I appreciate constructive criticism with merit and inputs after a proper code review. I hope you will find time for this.

Alozaros wrote:
also curl is not present on all routers and need to be installed via opt...

Yes, and the script checks for curl before executing. Adding wget support has been on my todo list for a while.

Alozaros wrote:
last thing if you D/L all those lines, from all those sources, you have to sed/sort them and erase the duplicates, otherwise you will be out of ram...

The script does all of the above. And more.

Alozaros wrote:
there are good ad-blocking scripts, that are confirmed as working and used from DDWRT community, just look around...

This is confirmed as working and there weren't any half decent scripts when I started writing one for myself. There still aren't with even 10% of the features this supports.

_________________

Routers
NETGEAR R7800 x2: DD-WRT v3.0-r42847 std (04/06/20)
NETGEAR R8500: DD-WRT v3.0-r41517 std (11/11/19)

Scripts
Adblock.sh on DD-WRT (v2) -- Github | Website
Ad-blocking on DD-WRT (v1) -- Github


Last edited by Yamaraj on Thu Jan 30, 2020 10:04; edited 1 time in total
Yamaraj
DD-WRT User


Joined: 25 Jan 2017
Posts: 110

PostPosted: Thu Jan 30, 2020 10:03    Post subject: Reply with quote
maciejrm wrote:
...
what could be the source of the issue?


Could be any number of reasons. If you are trying to add/replace lists, you have to ensure that those are being parsed appropriately. You will notice that not all lists are parsed the same way by the script because they are structured differently.

I recommend that you install a new version of this script (still a work-in-progress but stable and tested) and check errors.

Code:
curl -o adblock.sh adblock.sh
chmod +x adblock.sh


Another link: https://raw.githubusercontent.com/m-parashar/adblock/master/adblock.sh

Yes, you will have to change the script name in your router web admin too, if you have or want to set up cron.

Then execute it with --debug command line argument and see if there are any errors. Errors should be in log.adblock.errors file.

This new version also supports remote operations. If your router is not powerful enough to process these huge lists, set up the script on a Linux system, generate blocklists locally and automatically upload to your router via SSH. Tested on Raspbian/Raspberry Pi 4 and Ubuntu/ThinkPad X1 systems.

Code:
./adblock --remote=192.168.1.1


This example generates lists with defaults and uploads the blocklists to your router (192.168.1.1) if SSH is enabled. Note that this mode is interactive unless you set up ssh with keys for automatic authentication.

I will update the original post with fresh instructions and description of options in a day or two.

Report any bugs or issues here: https://github.com/m-parashar/adblock

_________________

Routers
NETGEAR R7800 x2: DD-WRT v3.0-r42847 std (04/06/20)
NETGEAR R8500: DD-WRT v3.0-r41517 std (11/11/19)

Scripts
Adblock.sh on DD-WRT (v2) -- Github | Website
Ad-blocking on DD-WRT (v1) -- Github
Alozaros
DD-WRT Guru


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

PostPosted: Thu Jan 30, 2020 14:26    Post subject: Reply with quote
sry Yamaraj, totaly miss looked the thread,
yep your script is working as it should,
I tried it in the past on my R7000 but it was quite aggressive,
nowadays as a script im using something short and useful,
otherwise have a look here, our forum member SurprisedItWorks
successfully compiled this script that is
decent too, im using something similar to it, but very very short Wink

https://forum.dd-wrt.com/phpBB2/viewtopic.php?t=321121&start=60

_________________
Atheros
TP-Link WR740Nv1 ---DD-WRT 55179 WAP
TP-Link WR1043NDv2 -DD-WRT 55303 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 55460 Gateway/DoH,Forced DNS,AP Isolation,4VLAN,Ad-Block,Firewall,Vanilla
Netgear R7800 --DD-WRT 55460 Gateway/DoT,AD-Block,Forced DNS,AP&Net Isolation,x3VLAN,Firewall,Vanilla
Netgear R9000 --DD-WRT 55363 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
Yamaraj
DD-WRT User


Joined: 25 Jan 2017
Posts: 110

PostPosted: Sat Feb 01, 2020 5:30    Post subject: Reply with quote
Alozaros wrote:
sry Yamaraj, totaly miss looked the thread,
yep your script is working as it should,
I tried it in the past on my R7000 but it was quite aggressive,
nowadays as a script im using something short and useful,
otherwise have a look here, our forum member SurprisedItWorks
successfully compiled this script that is
decent too, im using something similar to it, but very very short ;)

https://forum.dd-wrt.com/phpBB2/viewtopic.php?t=321121&start=60

No worries, Alozaros. Yes, it is fairly aggressive but only as much as the lists themselves since this script, not unlike others, uses lists curated by third parties. This is what prompted me to add custom black/white-lists which have precedence over the defaults and can unblock a domain blocked by overly aggressive lists. Such aggressors have also been moved to level-3 and -4; the defaults are pretty sane. Now with remote operations enabled the script can be executed from a more powerful system, making it easier to manage on less powerful routers too.

I'll grant that those short scripts are indeed useful to a degree, albeit lacking certain features I require on my routers. Despite all the features, it is still under 700 lines of POSIX shell code with comments and all. Not as bloated as most software these days. Still, I welcome any and all improvements - code quality, performance, methodology.

Thank you for giving it a try.

_________________

Routers
NETGEAR R7800 x2: DD-WRT v3.0-r42847 std (04/06/20)
NETGEAR R8500: DD-WRT v3.0-r41517 std (11/11/19)

Scripts
Adblock.sh on DD-WRT (v2) -- Github | Website
Ad-blocking on DD-WRT (v1) -- Github
Goto page Previous  1, 2, 3 ... 16, 17, 18 ... 21, 22, 23  Next Display posts from previous:    Page 17 of 23
Post new topic   Reply to topic    DD-WRT Forum Index -> General Questions 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