Joined: 04 Aug 2018 Posts: 1447 Location: Appalachian mountains, USA
Posted: Sat Jun 20, 2020 18:57 Post subject:
You actually quoted my words "This script is meant to be run just once, in Startup at boot time" but went ahead and told cron to run it periodically anyway. It was not designed with that in mind, and if you want to run it periodically, you need to analyze the code carefully to see if changes need to be made to make that work. (Sorry, I'm not volunteering.) It's been long enough now that my memory on the subject is faint, but what I remember is that it will NOT work that way as it is now.
Also, in early versions of the code, when I was using wget instead of curl, I was finding that in the dd-wrt build I was using, wget failed on https sites. It would only work with http sites. Experimenting now with my current build, I find that it works on some https sites but without the TLS certificate check. So it seems that whether wget will work on the https sites depends on which dd-wrt build you are using (and perhaps on which router, as builds can make some features available for some routers and not others, typically to respect memory limitations).
This is too complex a piece of code to "smoke test", what we used to call it when one built a complex piece of electronics and then, rather than test properly, section by section, just applied power to the entire system to see if it produced smoke. You need to test the downloading with wget by hand in the CLI to find out (1) whether it can work at all with your build and router and (2) what changes are needed to make it work. This does require basic linux shell skills, but it's the best I can offer, as I have only one router with one build to work with here, and I don't really have time to attempt to create a universal solution anyway.
My posting this in the first place was a willingness to share, not a promise to make it work on all systems. All I can really do is wish you good luck and point out that there are many online resources for new shell-script programmers. The most common linux shell is bash, so most online resources will be about bash programming. Our busybox shell in dd-wrt is missing some features of bash, but a great many bash techniques work without change in busybox. Test while learning. _________________ 2x Netgear XR500 and 3x Linksys WRT1900ACSv2 on 53544: VLANs, VAPs, NAS, station mode, OpenVPN client (AirVPN), wireguard server (AirVPN port forward) and clients (AzireVPN, AirVPN, private), 3 DNSCrypt providers via VPN.
I've been away for awhile, but way back when, I did promise a minimalist version of the adblocker I posted earlier. This youtube-only adblocker is derived from my latest, full-featured version (which you haven't yet seen but soon will). I've stripped out other block lists, diagnostics, most logging, blacklist, whitelist, and the timing feature that ensures that the network is up before beginning. Also, while this is still code for Startup, it now packages the main action as a shell script you can call from cron or wherever. The last line here calls it from Startup (with some delay first to make sure the network is up), but you can omit it if you'd rather just start it up later. I creates a /tmp/badhosts list of about 7,000 lines, and the downloads are logged in /tmp/badhosts.log.
[Edit Wed Jan 29 18:27 UTC 2020: Added an internal dnsmasq restart so that a previous badhosts won't corrupt the new nslookup value for manifest.google.com. Other minor tweaks also.]
This code is a stripped-down version of what I've been running successfully for a couple of weeks now, but in stripped-down form it has been tested only modestly. Take a look at the last line of badhosts (perhaps using tail /tmp/badhosts) to check the key manifest.googlevideo.com line. On some earlier dd-wrt builds (even as recently as early 2019), /tmp/root/adblocker will not run the file as a shell script as it should. In that case, do sh /tmp/root/adblocker instead.
Hello! I used this script and badhosts file filled correctly but I still has ads on youtube( What should I check?
Joined: 04 Aug 2018 Posts: 1447 Location: Appalachian mountains, USA
Posted: Tue Jun 23, 2020 22:14 Post subject:
I don't have an answer, but you are not alone. Recently I am also getting some youtube ads, though not on all videos and usually only at the beginning, not mid-video. I've suspected I do better in the first day or two after boot (when the code is run), but I am not sure. Psychologically youtube has won, because I've lost interest in wrestling with it all. There are more important things to be done. _________________ 2x Netgear XR500 and 3x Linksys WRT1900ACSv2 on 53544: VLANs, VAPs, NAS, station mode, OpenVPN client (AirVPN), wireguard server (AirVPN port forward) and clients (AzireVPN, AirVPN, private), 3 DNSCrypt providers via VPN.
I've been away for awhile, but way back when, I did promise a minimalist version of the adblocker I posted earlier. This youtube-only adblocker is derived from my latest, full-featured version (which you haven't yet seen but soon will). I've stripped out other block lists, diagnostics, most logging, blacklist, whitelist, and the timing feature that ensures that the network is up before beginning. Also, while this is still code for Startup, it now packages the main action as a shell script you can call from cron or wherever. The last line here calls it from Startup (with some delay first to make sure the network is up), but you can omit it if you'd rather just start it up later. I creates a /tmp/badhosts list of about 7,000 lines, and the downloads are logged in /tmp/badhosts.log.
[Edit Wed Jan 29 18:27 UTC 2020: Added an internal dnsmasq restart so that a previous badhosts won't corrupt the new nslookup value for manifest.google.com. Other minor tweaks also.]
This code is a stripped-down version of what I've been running successfully for a couple of weeks now, but in stripped-down form it has been tested only modestly. Take a look at the last line of badhosts (perhaps using tail /tmp/badhosts) to check the key manifest.googlevideo.com line. On some earlier dd-wrt builds (even as recently as early 2019), /tmp/root/adblocker will not run the file as a shell script as it should. In that case, do sh /tmp/root/adblocker instead.
Bro you can make a step by step method?
I need dnsmasq on and add this on "Additional Dnsmasq Options"?
Joined: 04 Aug 2018 Posts: 1447 Location: Appalachian mountains, USA
Posted: Fri Aug 07, 2020 0:22 Post subject:
No, it's not for dnsmasq options, though you do need to be using dnsmasq for DNS. It goes in the Startup code in GUI>Administration>Commands. So if you are completely unfamiliar with that Startup facility, you should certainly read up first. (In the wiki? I forget.) And ANYTHING you put in Startup should be carefully tested first in the CLI using ssh or PuTTY. Not doing that risks bricking a router. So you need to be familiar with using the CLI as well.
Maybe more fundamentally, a script of this complexity, even the simplified version, is not really for beginners who just want to follow a recipe. It's not intended for those who need a step-by-step, because I have no way to really test/debug it to the level of perfection a step-by-step requires or the time to do that. I don't know, for example, whether it will work on really old builds or what variety of routers it will work on. So to use it you may well need linux scripting and debugging skills.
I really hate to be negative on this subject, but trying to be generally helpful to people by sharing code can't reasonably be interpreted as a willingness to accept seriously time-consuming homework assignments. In this particular case, it's a question of the target audience. If you need a step-by-step, I feel bad, but I'm afraid you're just not in that audience, and there's no way I can quickly bring you in. There's just too big a learning curve. The adblocker experience has mostly convinced me it's time to pull back, that I've been oversharing and should keep all but the simplest dd-wrt scripts to myself. There are just too many who want to get to the end of the tunnel without dealing with the hard slog through the skills-development mountain needed to get there. I promise I'm cringing at my words here, but I can't see an honest way to sugar-coat it. _________________ 2x Netgear XR500 and 3x Linksys WRT1900ACSv2 on 53544: VLANs, VAPs, NAS, station mode, OpenVPN client (AirVPN), wireguard server (AirVPN port forward) and clients (AzireVPN, AirVPN, private), 3 DNSCrypt providers via VPN.
No, it's not for dnsmasq options, though you do need to be using dnsmasq for DNS. It goes in the Startup code in GUI>Administration>Commands. So if you are completely unfamiliar with that Startup facility, you should certainly read up first. (In the wiki? I forget.) And ANYTHING you put in Startup should be carefully tested first in the CLI using ssh or PuTTY. Not doing that risks bricking a router. So you need to be familiar with using the CLI as well.
Maybe more fundamentally, a script of this complexity, even the simplified version, is not really for beginners who just want to follow a recipe. It's not intended for those who need a step-by-step, because I have no way to really test/debug it to the level of perfection a step-by-step requires or the time to do that. I don't know, for example, whether it will work on really old builds or what variety of routers it will work on. So to use it you may well need linux scripting and debugging skills.
I really hate to be negative on this subject, but trying to be generally helpful to people by sharing code can't reasonably be interpreted as a willingness to accept seriously time-consuming homework assignments. In this particular case, it's a question of the target audience. If you need a step-by-step, I feel bad, but I'm afraid you're just not in that audience, and there's no way I can quickly bring you in. There's just too big a learning curve. The adblocker experience has mostly convinced me it's time to pull back, that I've been oversharing and should keep all but the simplest dd-wrt scripts to myself. There are just too many who want to get to the end of the tunnel without dealing with the hard slog through the skills-development mountain needed to get there. I promise I'm cringing at my words here, but I can't see an honest way to sugar-coat it.
Thanks! I added full code to startup and added dnsmasq lines to services:
addn-hosts=/tmp/badhosts
address=/1e100.net/0.0.0.0
Of course dnsmasq enabled on my ddwrt.
Thats good? Now i have yt adblock on dd wrt? Or i need somwthing more?
Joined: 16 Nov 2015 Posts: 6447 Location: UK, London, just across the river..
Posted: Fri Aug 07, 2020 5:11 Post subject:
preyseven7
did you add that long script to start up script??
if your router doesn't have a curl you have to use either wget or add curl...command..
of course its better to add that long ad-blocking script to custom script and call it from start script...just for better functionality...
in fact there are many scripts around, but so far
SurprisedItWorks its very good and kind of a simple script to work with...
im using something different for myself, once again thanks to SurprisedItWorks and some others around that dedicate/devote time to help the community.
I can do a step by step guide but first try your own...is better way to learn...
Also do keep in mind things in DD-WRT are changing fast so you have to learn it how to... and adapt those settings when there are vital changes in the firmware.. _________________ 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
Joined: 14 Dec 2015 Posts: 774 Location: 127.0.0.1
Posted: Sun Aug 09, 2020 5:33 Post subject:
Is there a way to implement this into a Pihole? _________________ Tutorial for flashing WRT series WRT Installation,Upgrade & Basic Setup–Cliff Notes
r52242: WRT3200ACM, WRT1200ACv1 & 1 Velop in bridge mode(IoT subnet), r52242 WRT1900ACv1 AP
Velop:2 WHW0101, RE6500, RE9000(AP)
Spectrum - 1000/50
SysLog Watcher 5, New security Onion box coming soon, Fingboxes, PiHoles, NEMS, Cacti, rpisurv
did you add that long script to start up script??
if your router doesn't have a curl you have to use either wget or add curl...command..
of course its better to add that long ad-blocking script to custom script and call it from start script...just for better functionality...
in fact there are many scripts around, but so far
SurprisedItWorks its very good and kind of a simple script to work with...
im using something different for myself, once again thanks to SurprisedItWorks and some others around that dedicate/devote time to help the community.
I can do a step by step guide but first try your own...is better way to learn...
Also do keep in mind things in DD-WRT are changing fast so you have to learn it how to... and adapt those settings when there are vital changes in the firmware..
OK I have a sbc.io/hosts adblock working via startup script and wanted to add this youtube block. However when I add all the lines to dnsmasq lines to services and add this to my startup it wont work. My guess is i'm overloading startup like you said. So how do I call the script from my startup command. I use the custom script as a collection for testing various commands to be put in startup/shutdown/firewall/. Really its just a placeholder. So how can I call the command with a tag from custom, cuz i dont necessarily want the whole custom script to run.
This is excellent job. Good to hear you have yet to see youtube ad. I hope this study will help everyone. If they change their system in the future we can figure out again. My current setup works perfectly. No Youtube ADs, clear videos. I enjoy AD-free Youtube
Hello mkaand,
Good job, your script is awesome man.
I am running TomateUSB into Linksys 6500 (used DD-wrt but for a while but switched to tomato for its bandwidth graphics that was the main reason on flashing my router) but Tomato does not count with recursive DNS feature and I wanted to ask you if there could be some other way to enable this (like some manual correction into the Dnsmasq deamon itself) or achieve this functionality with our using recursive DNS.
Joined: 08 May 2018 Posts: 14246 Location: Texas, USA
Posted: Fri Jun 25, 2021 15:36 Post subject:
Is your EA6500 a v1 or v2? The v2 is supported by freshtomato, which may help your situation. I would have to look and see what would need to be done to support the v1. _________________ "Life is but a fleeting moment, a vapor that vanishes quickly; All is vanity"
Contribute To DD-WRT Pogo - A minimal level of ability is expected and needed... DD-WRT Releases 2023 (PolitePol)
DD-WRT Releases 2023 (RSS Everything)
----------------------
Linux User #377467 counter.li.org / linuxcounter.net
Is your EA6500 a v1 or v2? The v2 is supported by freshtomato, which may help your situation. I would have to look and see what would need to be done to support the v1.
Hi, Thanks for your reply man. I have EA6500 V2 running Tomato v1.28.0000 -3.5-140 K26ARM USB AIO-64K. I have OPKG installed as well and saw that unbound-control-setup is included on that repo. I spent some time reading change log of FreshTomato and it seems that Recursive dns is not a feature informed there, could it be?
But I am not sure if Recursive DNS can be enabled into my router. If i am not mistaken, is the functionality to force outbound DNS queries going to another Server to resolve with my local DNS server, right?. Because if there is some extra work that could be done to keep my firmware I will love to keep it cause i have tested some FreshTomato releases from past years and they gave me some hard times (Does not recognize the Wireless card as an example)
My previous Ads Blocker method stop working (using Kodi with Youtube API Keys) but is working worst and worst every month and just saw this magic post.
Last edited by ALX1S on Sun Jun 27, 2021 23:01; edited 1 time in total
Joined: 04 Aug 2018 Posts: 1447 Location: Appalachian mountains, USA
Posted: Sun Jun 27, 2021 17:05 Post subject:
My Amazon Prime video streaming stopped working, and it turned out to be due to the adblocker. My block list may be different than yours, as I've changed my list of source sites in the months since I last posted here, but FWIW, Amazon Prime video is restored here by whitelisting (and I can barely believe this myself)
s3-iad-2.cf.dash.row.aiv-cdn.net
in spite of how strange that looks. The fact that IAD is in it makes me think this may be different in different regions, as IAD is Dulles International Airport in Washington, DC. But if you are having Amazon Prime Video trouble and whitelisting this doesn't fix it, search your badhosts file for something similar. When I do grep -F 2.cf.dash.row.aiv-cdn.net /tmp/badhosts I get only the line containing the above domain in response. Maybe you'll get something else.
You also could try casting a slightly wider net by adding dash.row.aiv-cdn.net to the ALLWHITE list instead. That would whitelist that domain and any ending with ".dash.row.aiv-cdn.net" as well. Here that matches only the "iad" domain above. _________________ 2x Netgear XR500 and 3x Linksys WRT1900ACSv2 on 53544: VLANs, VAPs, NAS, station mode, OpenVPN client (AirVPN), wireguard server (AirVPN port forward) and clients (AzireVPN, AirVPN, private), 3 DNSCrypt providers via VPN.
Thank you very much for nice comments. You are free to improve or fork my work. It is open license. You an create dnsmasq version or you can modify for other systems like PiHole.
Hi, thanks you so much for this, I am using it on vainilla Adsblock on TomatoUSB (no recursive DNS feature) and is filtering the youtube adds that appear in the middle of the video, but still not being able to filter the ones at the start of the video (that could suggest that are the dynamic host ads)
I've been away for awhile, but way back when, I did promise a minimalist version of the adblocker I posted earlier. This youtube-only adblocker is derived from my latest, full-featured version (which you haven't yet seen but soon will). I've stripped out other block lists, diagnostics, most logging, blacklist, whitelist, and the timing feature that ensures that the network is up before beginning. Also, while this is still code for Startup, it now packages the main action as a shell script you can call from cron or wherever. The last line here calls it from Startup (with some delay first to make sure the network is up), but you can omit it if you'd rather just start it up later. I creates a /tmp/badhosts list of about 7,000 lines, and the downloads are logged in /tmp/badhosts.log.
[Edit Wed Jan 29 18:27 UTC 2020: Added an internal dnsmasq restart so that a previous badhosts won't corrupt the new nslookup value for manifest.google.com. Other minor tweaks also.]
This code is a stripped-down version of what I've been running successfully for a couple of weeks now, but in stripped-down form it has been tested only modestly. Take a look at the last line of badhosts (perhaps using tail /tmp/badhosts) to check the key manifest.googlevideo.com line. On some earlier dd-wrt builds (even as recently as early 2019), /tmp/root/adblocker will not run the file as a shell script as it should. In that case, do sh /tmp/root/adblocker instead.
I got this to block ads on youtube. But unfortunately doesn't work on my SmartTV. Ads doesn't load but the video gets stuck at loading icon. So I guess doesn't work well with Tizen OS app.