Script: Clean, Lean and Mean Adblocking


Istn the DHCP Option 6 the DNS Server provided by DHCP? In other words: Client requests IP and stuff via DHCP and gets as DNS Server the Server you specified (208.67.220.220)? So he would not contact your Routers dns --> Adblock will not work.
Just try a ipconfig /all on your Client - you will see that DNS Server is not your Routers IP but the OpenDNS Server

You could do the trick with leaving DHCP Option 6 (DNS) at Default values/removing that line from dnsmasq config and specify the OpenDNS Server in the Basic Tab (Static DNS).
To only use OpenDNS for resolving hostnames on WAN you Need to uncheck in Advanced->DNS/DHCP Options "Use received DNS with user-entered DNS"

EDIT: I've just read through history and know I understand the issue... BR1 .
Sorry for missunderstandig. I'll leave the reply as is if anyone else has some similiar issues...

EDIT2: Can you try 'dhcp-option=dp,6,192.168.2.1,208.67.220.220' replace 192.168.2.1 with Routers br1 Interface ip
 
This is most excellent, harp, thank you. I'm hoping this will stop the issue of pixelsrv crashing when I make minor config changes.

One small request, for the sake of clarity, could you capitalize or bold or colorize the font for the pastebin links indicated by the "this link" text? They weren't highlighted in my browser, which confused me for a bit. Thanks.
 
New challenge. :) I have a separate network on br1. One of the computers on that interface I have set to use opendns. Apparently, since it uses opendns as the dns server instead of the router as the dns server the adblock doesn't work. Is there some way you can fix the script to have it use pixelserv for the block list but use opendns for everything else?

EDIT: The more I think about it, this maybe a dnsmasq setup issue. I going to ask on their discussion list first. Just to verify, your script essentially adds all the hosts to dnsmasq.custom for dnsmasq to use correct?
Correct. You could enable "Intercept DNS port(UDP 53)" to force the OpenDNS clients to use dnsmasq regardless, and then set OpenDNS as the router's DNS server. But there is no way to have a hybrid approach, like you're asking.

This is most excellent, harp, thank you. I'm hoping this will stop the issue of pixelsrv crashing when I make minor config changes.

One small request, for the sake of clarity, could you capitalize or bold or colorize the font for the pastebin links indicated by the "this link" text? They weren't highlighted in my browser, which confused me for a bit. Thanks.
Consider it done
 
I don't know how and why but since yesterday my router Begins to freeze with active Adblock script... Dnsmasq is running with 100% cpu load - and can not be killed.
(Asus RT-N66U with v108 Shibby Mod)

Is there any way to log whats happening? I stopped adblock script via "sh adblock.sh stop" now everything is fine again :S

EDIT: Seems that my Asus RT-N66U is bricked/dead. He stops working after approx 10min... I'll order a new one to test...
I think its a hardware-related issue due sometimes he just boots in recovery mode :S

EDIT2: My replacement Asus now is working normally - so this post can be ignored...^^
 
Foolproof instructions. Mounted usb drive is my PREFIX. Installed pixelserv, script and config, and added into WANUP, scheduler. Thanks for everything.
 
Just an idea for those of us who like to keep large blacklists/whitelists... Why not introduce an option for script to handle separate files for "whitelist" and "blacklist" instead of just entering lines of hosts in CONFIG.

Otherwise it DOES work better than All-in-one...
 
Thanks for this, it suits my needs than ALL-U-NEED. I'm running Toastman on an RT-N16 with a CIFS mount for external storage needs.

Also: I run something called nullserv on a Linux box, which is like pixelserv but it also serves up dummy files of formats besides .gif. I was able to get it working with this ad blocker by configuring the ad blocker not to use pixelserv, and then changing the default redirect IP from 0.0.0.0 to 192.168.1.4 (my Linux box IP).
 
nullserv.c source is here
https://github.com/flexiondotorg/nullserv/blob/master/nullserv.c,
runs under a inetd, as did the adblock using pixelserv in dd-wrt optware solution OTRW
should be easy to compile for router, and I will do that sometime since there's some strange code using "==" to compare strings that doesn't look correct!
Would be easy to add the different responses to the standalone c-pixelserv which has its own sticky thread on this forum if anyone interested.
 
Oh yeah, I totally forgot about that. I fixed it to use strcasecmp() in my local copy. I just notified the author and sent him my local copy, which I should have done in the first place.

If anyone is interested in my local copy, PM me.

Would love to see something that runs on the router and serves up more than just .gif's.
 
Just an idea for those of us who like to keep large blacklists/whitelists... Why not introduce an option for script to handle separate files for "whitelist" and "blacklist" instead of just entering lines of hosts in CONFIG.

+1
 
Add one more source and you have your blacklist... SOURCES="$SOURCES http://www.example.com/blacklist.txt"


I used to do that and keep NAS webserver up for only two files, whitelist and blacklist. Since a complete overhaul of adblocking script was done, I expected that this time author will think of keeping whitelist/blacklist in a file, especially because script itself relies heavily on usb/jffs storage.

I guess we'll just have to wait for haarp to make an apearance and plead our case with him XD
 
nullserv.c source is here
https://github.com/flexiondotorg/nullserv/blob/master/nullserv.c,
runs under a inetd, as did the adblock using pixelserv in dd-wrt optware solution OTRW
should be easy to compile for router, and I will do that sometime since there's some strange code using "==" to compare strings that doesn't look correct!
Would be easy to add the different responses to the standalone c-pixelserv which has its own sticky thread on this forum if anyone interested.
FYI, the author of nullserv has merged my changes into his github repo version.

Diff: https://github.com/flexiondotorg/nullserv/commit/86e652a340d9fa8436efe3661587024fdb7cb6b2?w=1

Would love to see a native router compile. I can't find clear/non-scary directions for setting up a native or cross-compiler toolchain, or else I'd try it myself.
 
FYI, the author of nullserv has merged my changes into his github repo version.

Diff: https://github.com/flexiondotorg/nullserv/commit/86e652a340d9fa8436efe3661587024fdb7cb6b2?w=1

Would love to see a native router compile. I can't find clear/non-scary directions for setting up a native or cross-compiler toolchain, or else I'd try it myself.


Wow, small program. I went ahead and made a static binary, so should run in most places.
http://lancethepants.com/files. In the binary section.
edit: I also compressed it using upx. Sits at 102.1 KB

Compiled with Tomatoware, also available on my site.
https://github.com/lancethepants/tomatoware
 
Okay, so I'm an idiot. How do I run it without inetd?

If I try to run it on its own, it segfaults.
 
Okay, so I'm an idiot. How do I run it without inetd?

If I try to run it on its own, it segfaults.

It shouldn't segfault, just sit there waiting for input from stdin.

But it is pretty useless without inetd or equivalent. xinetd is available under entware or optware.

I've tested and it seems to work OK, but I wonder about performance under xinetd/inetd. Wish it was capable of listening natively.
 
It shouldn't segfault, just sit there waiting for input from stdin.
Yeah, it doesn't segfault unless I hit the Enter key. That's probably OK, as that was probably an unexpected input.

But it is pretty useless without inetd or equivalent. xinetd is available under entware or optware.
I looked for inetd on entware, but I guess my searching was too restrictive to pick up on the presence of xinetd. I'll have to search again.

I've tested and it seems to work OK, but I wonder about performance under xinetd/inetd. Wish it was capable of listening natively.
So the idea of enhancing pixelserv to support more formats may be the best solution for this use case then.

The author of nullserv says that my interest has re-ignited his, so maybe I'll ask him about making a standalone daemon mode.

Edit: Sent him an email, and included pixelserv v30

Edit 2: Got this response:
I don't mind which route is followed, either adding more mime types to pixelserv or adding a daemon to nullserv. I don't have the time to add a daemon to nullserv myself. Contributions welcome :)

I'll tinker with nullserv a little next week to try and clean it up a bit. I'll be pushing an adblock host compiler script to the nullserv repository later though. Might be of interest.

What does this do that is different than pixelserv? Why would we want to switch?
As far as I know, pixelserv only serves up 1x1 gif files in response to all requests.

Nullserv, on the other hand, serves up gif, jpg, swf (flash), and text data to satisfy web page's requests for around 11 file extensions using around 8 MIME types. I haven't tried pixelserv, but I would imagine that by serving up something closer to what is being asked for, pages should look a little less disrupted by the removal of ads.
 

Back
Top