@MrPickles
blocking IP list was working for me but router got bricked somehow, wireless was not working at all maybe due reasons i explained, for Vizio TV with cromecast was ok and only saw some initial 10 seconds ads by youtube, can't add all ip ranges needed due to lack of this router resources, had to recover backup of all config and it's working without any script or firewall rules
we just can't black list the *.googlevideo.com host/ip because it's shared between other videos, this is demonstrated and commented in some other forums, so i came to the conclusion to redirect youtube video host's to other that didn't give any ads while playing, this time i used netstat to find all host used while playing a video. found like 5 or 4 *.1e100.net used, some in standby and other with connection established, tested each ip associated with those host and got the one that didn't display any ADS
you have to find out which of the cache servers don't display ads and redirect all other host like i have it in dnsmasq options
to find ip redirector 1e100.net ranges use: hxxps://www.robtex.com/cidr/172.217.19.46-24
there are many.. not only .19 range, you could test with other ranges like 172.217.21.xx etc etc
my static DNS are: see screen shot
in the advanced routing options, just in case, i blocked google's public dns:
Quote:
8.8.8.8 and 8.8.4.4
i have seem some videos longer than 20 minutes and the video is not interrupted with ADS in the middle or end, the worst ADS are those has 3 or 4 minutes of video duration, haven't seen any for days
i believe google already black listed the redirector i used in my previous post, so everyone has to find one of those cache redirector sites that won't give the ADS Alarm and will redirect to one of the *.googlevideo.com url host without AD intervention
i'm writing about one of those 1e100.net host, not all needs to be blocked, you need to test which of those don't display ADS while using youtube, use it and test, redirect manifest and/or the googlevideo url's found in the html source code for your ISP
etc etc where xxxxxx will be different for each ISP) i supplied the ones i got but for other ISP i believe are different so by now you could redirect only manifest.googlevideo.com and block the rest of 1e100.net host, the other configs are needed to block rest of google's/youtube video ads and banners
only the statics *.googlevideo.com url found in the html source code i redirect them, no need to redirect any other as i did before so i removed them from previous post, also is not needed to block any googlevideo.com ip's
for each ISP/region location google use different host so i explained the best possible as generic way so everyone could handle this, so far so good, android + windows without ads, the trick is to find the good boy redirector as explained. this should work with any smart tv including apple devices
Joined: 04 Aug 2018 Posts: 1447 Location: Appalachian mountains, USA
Posted: Mon Jan 27, 2020 19:52 Post subject:
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. _________________ 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.
Joined: 04 Aug 2018 Posts: 1447 Location: Appalachian mountains, USA
Posted: Mon Jan 27, 2020 20:54 Post subject:
Here is the new, improved version of my adblocker. The reason to use it, even if you want only youtube blocking, is to get the logging and diagnostics and safety features. If you don't like it downloading other block lists, just delete the DownloadURL lines for the lists you don't want to use! Don't want a blacklist? Delete its entries. I've split the whitelist here into two lists, the WHITE list and the ALLWHITE list. Putting foo.com in the WHITE lists just whitelists foo.com. Putting it in the ALLWHITE list whitelists both foo.com and *.foo.com. Using two lists simplified practical whitelisting. Don't like the whitelists? Delete all entries from those lists. It's fine for all these lists to be empty.
There is a new separate PTRLIST here of sites that need special treatment like we've been giving manifest.google.com. These are ad-related sites that in the public DNS system have reverse lookups that don't point back to the original domain but instead point to weird-looking domain names seem to be somehow useful in their ad systems. Don't want those two other sites in that list? Delete them. However, to block youtube ads, you must keep manifest.google.com in that list.
This script is meant to be run just once, in Startup at boot time. If I don't reboot for a few days, I start to see youtube ads again. I suspect this is because the badhosts line for manifest.google.com has become too old. But modifying this script so that it could be rerun periodically, say by cron, would require some thought. This is because if you use "Forced DNS Redirection," like I do here, nslookup (in the script) will obtain the wrong IP for manifest.google.com (it will obtain 0.0.0.0) if the blocker is already running. On an ordinary linux system, nslookup could be run with a -port=blah argument to get around the forcing, but on dd-wrt nslookup does not accept the -port argument. So this script works best on systems that get rebooted daily or near daily. _________________ 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.
Joined: 04 Aug 2018 Posts: 1447 Location: Appalachian mountains, USA
Posted: Wed Jan 29, 2020 18:35 Post subject:
I just did some tweaking of the short version of my youtube blocker above at https://forum.dd-wrt.com/phpBB2/viewtopic.php?t=322606&start=52. See the edit comment just after the code. _________________ 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.
@SurprisedItWorks
your script never work with me, in both i got IP 0.0.0.0 so all went down, will be better to specific which router model you have and firmware, i believe this is not for any router.
Joined: 04 Aug 2018 Posts: 1447 Location: Appalachian mountains, USA
Posted: Thu Feb 13, 2020 21:59 Post subject:
Rickz wrote:
@SurprisedItWorks
your script never work with me, in both i got IP 0.0.0.0 so all went down, will be better to specific which router model you have and firmware, i believe this is not for any router.
As my sig says, I'm on Linksys WRT1900ACSv2 routers. They are pretty fast and have a decent amount of memory, so an older, smaller router might indeed be an issue, especially if you try to keep my long list of Download sites. Maybe commenting out many of the downloads to try a small version would make sense. You also might want to experiment with longer sleep times up front. Some older releases for smaller routers do not have curl on them. If you are in that boat, replace curl -kf with wget -O - (including that final hyphen) in the definition of Download.
I've run this on releases 40009, 40784, and 41954. Haven't seen any build-specific issues.
I'm not in a position to say much more. If you have shell-script skills, it shouldn't be too hard to test it out in pieces in ssh to perhaps discover where the issue lies. _________________ 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.
how do i know if i have to edit it accordingly your last comment :
Quote:
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.
how i know if i have to use:
Quote:
sh /tmp/root/adblocker
and which lines i should replace in the script ?
also i have a doubt about which is the best, stripped-down version or should i use the full long version ??
how do i know if i have to edit it accordingly your last comment :
Quote:
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.
how i know if i have to use:
Quote:
sh /tmp/root/adblocker
and which lines i should replace in the script ?
also i have a doubt about which is the best, stripped-down version or should i use the full long version ??
thanks in advance
Greetings, RickZ. In the CLI, simply do ls -l /tmp/badhosts* after you are sure more than 90 seconds has passed since boot. If the script didn't run (so that you need the sh approach), you'll get a message that there are no such files. (It's also possible that you'll have dnsmasq trouble, since you've told it to look for badhosts. I'm not sure on that point.). But if ls lists /tmp/badhosts and /tmp/badhosts.log, then certainly the script ran and you don't need the sh.
In the latter case do cat /tmp/badhosts.log to have a look at the script's download log. The curl command curl in the script should have written three lines (at least in my version of dd-wrt) to this file, two of header labels and one line showing how the download went. On the left look for 100% of the file to have been downloaded. If that looks good, for a bit more confidence building, do wc -l /tmp/badhosts to see how many lines (one per domain blocked) are in the badhosts[/b] file. Should be thousands I believe, for that particular file. Finally do tail /tmp/badhosts to see the last ten lines of the [i]badhosts file. All the lines except the last should look like "0.0.0.0 " followed by a domain name, and the last line should be some nonzero IP address followed by manifest.googlevideo.com.
Those are the basic checks. Since as presented, that super-abbreviated form of the script does not download the thousands of youtube-specific domains that people identified early in this thread, it may or may not do anything useful for youtube blocking. But it should certainly block a lot of other ad-related nonsense. Try nslookup (I'm not sure of the precise Windows syntax, but it's easy to google) of one of the sites you saw zeros for in the tail... command above to verify that it gives you a 0.0.0.0 IP address. (I don't know that I'd try visiting one in a browser, because some malware sites can abuse a simple visit. No problem if the blocking works, right?)
If the files are not present, before you look at the sh option, try increasing the 90 second number at the end to 300 seconds, reboot, and wait 5 min before checking things out. That'd be just to be sure the problem was not a timing issue.
I haven't waded through the details of your edited version of the script to see how it differs from what I posted, so I can't comment on that. I'm not sure what you are asking when you say "which lines i should replace in the script?" Replace with what goal? As to which version to use. Try this simple version, see if it works for what you want. If youtube is still a problem, I believe with the WRT1900ACv2 you'll be good to try the full version (as that router is almost identical to mine), though be sure you have at least 4K (more would be safer) of free nvram space (see the status page in the GUI) before you try installing it in the Startup section. Really, really bad things happen when you run out of nvram space. I like the long version of the script for the exception lists but also for the greater diagnostics: a [b]badhosts.codes[b] file, a couple of syslog entries, etc. And it is easier to add or delete download sites in that version, so you could cut it down a bit and use only the sbc.io site of your version above plus the youtube-related sites, if you still want to tilt towards the minimal. It'd be easy enough to zero out the whitelists and blacklist and keep only the manifest.google.com entry in the other list as well. _________________ 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.
Posted: Sat Jun 20, 2020 14:10 Post subject: Trying new AdBlock script on TP-Link TL-WR841ND v9
SurprisedItWorks wrote:
Here is the new, improved version of my adblocker. The reason to use it, even if you want only youtube blocking, is to get the logging and diagnostics and safety features. If you don't like it downloading other block lists, just delete the DownloadURL lines for the lists you don't want to use! Don't want a blacklist? Delete its entries. I've split the whitelist here into two lists, the WHITE list and the ALLWHITE list. Putting foo.com in the WHITE lists just whitelists foo.com. Putting it in the ALLWHITE list whitelists both foo.com and *.foo.com. Using two lists simplified practical whitelisting. Don't like the whitelists? Delete all entries from those lists. It's fine for all these lists to be empty.
There is a new separate PTRLIST here of sites that need special treatment like we've been giving manifest.google.com. These are ad-related sites that in the public DNS system have reverse lookups that don't point back to the original domain but instead point to weird-looking domain names seem to be somehow useful in their ad systems. Don't want those two other sites in that list? Delete them. However, to block youtube ads, you must keep manifest.google.com in that list.
This script is meant to be run just once, in Startup at boot time. If I don't reboot for a few days, I start to see youtube ads again. I suspect this is because the badhosts line for manifest.google.com has become too old. But modifying this script so that it could be rerun periodically, say by cron, would require some thought. This is because if you use "Forced DNS Redirection," like I do here, nslookup (in the script) will obtain the wrong IP for manifest.google.com (it will obtain 0.0.0.0) if the blocker is already running. On an ordinary linux system, nslookup could be run with a -port=blah argument to get around the forcing, but on dd-wrt nslookup does not accept the -port argument. So this script works best on systems that get rebooted daily or near daily.
Hello, I just used above script and its give few errs with wget attach screenshots for reference:-
P.S. - Normally it start in less than 1 min but this time it took almost more than 5 mins. _________________ >>TP-Link TL-WR841ND v9
>>DD-WRT v3.0-r43397 std (06/13/20)
>>TP-Link TL-WR841ND v9
>>DD-WRT v3.0-r45735 std (02/11/21)