Adblock for DD-WRT (version 2)

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


Joined: 25 Jan 2017
Posts: 110

PostPosted: Sat Feb 01, 2020 8:22    Post subject: Reply with quote
20200201:
MAJOR UPGRADE. Now supports remote operations as well. If your router is not powerful enough to run this script, you can now install this on a Linux system/Raspberry Pi and use the --remote=(router ip address) option to upload generated lists via SSH. Note that this mode is interactive and you will asked for your router's root password (not saved anywhere). To automate this, you can configure router with ssh keys.

Automatic fallback to wget if curl is unavailable. Not recommended though as BusyBox wget is severely limited in functionality and scope.

This release also supports DEBUG output if you face any errors. Check command line options.

How to install/upgrade:
SSH into router
cd /jffs/dnsmasq
curl -o adblock.sh adblock.sh (or wget -O adblock.sh adblock.sh)
chmod + adblock.ah

Then follow instructions in the original post to set up dnsmasq and cron.

adbhostgen (old version) is still functional and will remain so for a while. No new features will be added to this, so I recommend that you upgrade and change "adbhostgen.sh" to "adblock.sh" on all the relevant config pages.


_________________

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
Sponsor
cursemex
DD-WRT Novice


Joined: 15 Dec 2014
Posts: 48

PostPosted: Tue Feb 11, 2020 0:26    Post subject: Reply with quote
I keep getting permission denied whenever I use ./adbhostgen.sh
I did use chmod +x adbhostgen.sh before it
joedow
DD-WRT Novice


Joined: 11 Feb 2018
Posts: 46

PostPosted: Tue Feb 11, 2020 5:03    Post subject: Reply with quote
Hi Yamaraj, good work andnplease keep it up.

Can you tell me if this list from easylist.to is
added to your adblock?
Or if i make a blacklist out of it will it work?
Yamaraj
DD-WRT User


Joined: 25 Jan 2017
Posts: 110

PostPosted: Wed Feb 12, 2020 5:41    Post subject: Reply with quote
cursemex wrote:
I keep getting permission denied whenever I use ./adbhostgen.sh
I did use chmod +x adbhostgen.sh before it

This is strange. Try chmod u+x or chmod 0755. If all else fails, you can do sh <scriptname>.

I also strongly recommend that you try the new version adblock.sh.

_________________

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: Wed Feb 12, 2020 5:42    Post subject: Reply with quote
joedow wrote:
Hi Yamaraj, good work andnplease keep it up.

Can you tell me if this list from easylist.to is
added to your adblock?
Or if i make a blacklist out of it will it work?

This script, like Pi-Hole and others, operates at domain level not on page elements and as such cannot use those lists. Although quite effective, it cannot block 100% of ads, especially those leveraging browser features like Javascript, frames etc. For that adding another layer of protection like uBlock Origin is recommended.

I recommend this script or Pi-Hole on your network anyway as not all devices have access to browser-level blocking. Besides, since this operates at network level, requests other than browsers are blocked as well.

_________________

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
joedow
DD-WRT Novice


Joined: 11 Feb 2018
Posts: 46

PostPosted: Wed Feb 12, 2020 5:53    Post subject: Reply with quote
I was searching for romanian block lists, and stumbled upon that easylist.to.

Youre adblocker works well, i am using it Smile. The onky ads im geting are romanian ads, where i am from.
cursemex
DD-WRT Novice


Joined: 15 Dec 2014
Posts: 48

PostPosted: Wed Feb 12, 2020 18:36    Post subject: Reply with quote
Yamaraj wrote:
cursemex wrote:
I keep getting permission denied whenever I use ./adbhostgen.sh
I did use chmod +x adbhostgen.sh before it

This is strange. Try chmod u+x or chmod 0755. If all else fails, you can do sh <scriptname>.

I also strongly recommend that you try the new version adblock.sh.


Ah, silly me. I had it in /opt/ directory rather in /jffs/ directory. All is working well now Smile Thanks Yamaraj.

I'll update if anything stands out after testing the script for a while.
joedow
DD-WRT Novice


Joined: 11 Feb 2018
Posts: 46

PostPosted: Mon Feb 17, 2020 19:52    Post subject: Reply with quote
when trying to run updated version i get this:

adblock.sh: line 696: tee: not found

EDIT:
i updated adbhostgen.sh and after run it and it is working.

adblock.sh gives the error code (smth with logfile)
Yamaraj
DD-WRT User


Joined: 25 Jan 2017
Posts: 110

PostPosted: Thu Feb 20, 2020 1:28    Post subject: Reply with quote
joedow wrote:
when trying to run updated version i get this:

adblock.sh: line 696: tee: not found

EDIT:
i updated adbhostgen.sh and after run it and it is working.

adblock.sh gives the error code (smth with logfile)


Oh, FFS! The firmware on your router doesn't come with this tiny useful binary. I will update adblock.sh soon with some other logging method. Until then, the old version should do the job.

_________________

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
joedow
DD-WRT Novice


Joined: 11 Feb 2018
Posts: 46

PostPosted: Thu Feb 20, 2020 3:53    Post subject: Reply with quote
Im sorry, dont get upset.
Yamaraj
DD-WRT User


Joined: 25 Jan 2017
Posts: 110

PostPosted: Thu Feb 20, 2020 5:55    Post subject: Reply with quote
joedow wrote:
Im sorry, dont get upset.


Oh, that was just an expression of frustration at the unavailability of this tiny binary in some versions of firmware. Certainly not directed at you. I am sorry for not making it clear enough.

Please report any other issues you encounter while using either versions. Thank you.

_________________

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
Dr_K
DD-WRT User


Joined: 23 Mar 2018
Posts: 445

PostPosted: Thu Feb 20, 2020 16:26    Post subject: Reply with quote
Once again Thank you Yamaraj for sharing your work

I have been using your new script (adblock.sh) since its release without any real issues
on a R6300V2 running firmware DD-WRT v3.0-r39345M kongac (04-03-19) using the options -2sF


1 observation..

In a rather quick test...
The pause function does not appear to fully disable the script
I did clear browser cache & cookies, even rebooted pc
Nor is running the -p or -r options reflected in the script's log


1 complaint..

I would prefer the script's log to amended itself, like your last script (adbhostgen.sh) did.
Rather than overwriting the log every time the script runs?

_________________
Location 1
R7800- DD-WRT v3.0-r53562 (10/03/23) Gateway
WNDR3400v1 DD-WRT v3.0-r35531_mega-nv64k (03/26/18 ) Access Point
WRT160Nv3 DD-WRT ?v3?.0-r35531 mini (03/26/18 ) Access Point
WRT54GSv5 DD-WRT v24-r33555_micro_generic (10/20/17) Repeater
Location 2
R7800- DD-WRT v3.0-r51855 (02/25/23) Gateway
R6300v2- DD-WRT v3.0-r50671 (10-26-22) Access Point
WNDR3700v2 DD-WRT v3.0-r35531 std (03/26/18 ) Access Point
E1200 v2 DD-WRT v3.0-r35531 mega-nv64k (03/26/18 ) Gateway(for trivial reasons)
RBWAPG-5HACT2HND-BE RouterOS-v6.46.4 (2/21/20) Outdoor Access Point
2x RBSXTG-5HPACD RouterOS-v6.46.4 (2/21/20) PTP Bridge 866.6Mbps-1GbpsLAN
Location 3
2x R7000- DD-WRT v3.0-r50671 (10/26/22) Access Points
2x RBWAPG-60AD RouterOS-v6.45.9 (04/30/20) PTP Bridge 2.3Gbps-1GbpsLAN
2x RBSXTsqG-5acD RouterOS-v6.49.7 (10/14/22) PTP Bridge 866.6Mbps-1GbpsLAN

Thank You BrainSlayer for ALL that you do & have done, also to "most" everyone here that shares their knowledge
jerksto
DD-WRT Novice


Joined: 24 Feb 2020
Posts: 1

PostPosted: Mon Feb 24, 2020 2:12    Post subject: Reply with quote
Followed the setup exactly, and the script runs everything perfectly. However, it appears dnsmasq is not launching with the config settings in "Additional Dnsmasq Options" on reboot. When I run ps | grep dnsmasq, it says it is running with the default tmp config:
Code:
14886 root     dnsmasq -u root -g root --conf-file=/tmp/dnsmasq.conf

If I killall dnsmasq, and stopservice dnsmasq, and try to manually launch dnsmasq with the correct config, it will tell me port 53 is already in use.
Code:
# dnsmasq --conf-file=/jffs/dnsmasq/mpdomains --addn-hosts=/jffs/dnsmasq/mphosts

dnsmasq: failed to create listening socket for port 53: Address in use


If I check with netstat, 53 is being used by "unbound".

Code:
# netstat -nlp
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
tcp        0      0 0.0.0.0:53              0.0.0.0:*               LISTEN      15060/unbound


If I kill this process id, and then start dnsmasq, it works. But I can't kill an unknown id upon boot every time and would have to manually do this in case of a reboot.

Any ideas on what's wrong with my setup?

edit: nevermind, I didn't realize "unbound" was the name of an actual program... thought that was akin to "unknown".

Using Netgear R6700, DD-WRT v3.0-r42287 std (02/06/20)[/b]
Yamaraj
DD-WRT User


Joined: 25 Jan 2017
Posts: 110

PostPosted: Sat Feb 29, 2020 13:44    Post subject: Reply with quote
Dr_K wrote:
Once again Thank you Yamaraj for sharing your work

I have been using your new script (adblock.sh) since its release without any real issues
on a R6300V2 running firmware DD-WRT v3.0-r39345M kongac (04-03-19) using the options -2sF


1 observation..

In a rather quick test...
The pause function does not appear to fully disable the script
I did clear browser cache & cookies, even rebooted pc
Nor is running the -p or -r options reflected in the script's log


1 complaint..

I would prefer the script's log to amended itself, like your last script (adbhostgen.sh) did.
Rather than overwriting the log every time the script runs?


Thanks for feedback. I will make these necessary changes in the next update.

_________________

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
awpfab
DD-WRT Novice


Joined: 18 Aug 2019
Posts: 13

PostPosted: Tue Mar 03, 2020 0:34    Post subject: Wifi Oddities Reply with quote
I believe I have the adblock running correctly. Thank you to all who developed this!

Now that it is running, I am having odd Wifi responses and I didn't know if others may have run into them as well.

My wired computers and Rokus run just fine (better than fine; the ads are blocked!). My wireless Roku seems to do just fine as well.

Here's where it gets flaky. With data off, I can send/receive texts from my phone... which is odd because my phone's says that the wifi cannot get an IP address from my router. The texts should not pass. In fact all of the wireless devices (Apple, Samsung) think that they cannot get an IP address from either the 2.4G or 5G service.

Even more odd is that my router (WRT32XB) thinks that it has handed out IP addresses as I can see the wireless devices' MAC addresses in the connection table.

There's no functionality cross over between wifi connectivity and the DNS that I'm missing is there?

My router status says it's running < 1% load (temp = 75C) and has 58% free memory (not accounting for an additional 1G of swap space on a USB drive). So, I don't think it's struggling to keep up.

Update: If I set up each wireless device as a Static IP address, they connect to the router. I'm frustrated with this so I'm not seeing the obvious... Any thoughts?

Double Update: One of the Ipads additionally needed the DNS set up to go through the router before Safari would surf.

FINAL Update: I re-ran the adblock.sh script and it appears it was not completing correctly due to an issue with curl. After getting entware installed, then curl installed, I re-ran the script and can see that it runs more completely. The network appears to now work.
Goto page Previous  1, 2, 3 ... 17, 18, 19 ... 21, 22, 23  Next Display posts from previous:    Page 18 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