Simple-adblock: fast, lean and fully uci/luci configurable AdBlocking

I'm trying to whitelist googleadservices but I'm not having any luck. How can I figure out the problem?

simple-adblock 1.6.3-5

|       |.-----.-----.-----.|  |  |  |.----.|  |_
 |   -   ||  _  |  -__|     ||  |  |  ||   _||   _|
 |_______||   __|_____|__|__||________||__|  |____|
          |__| W I R E L E S S   F R E E D O M
 -----------------------------------------------------
 OpenWrt 18.06.1, r7258-5eb055306f
 -----------------------------------------------------
root@OpenWrt:~# nslookup googleadservices.com
Server:         127.0.0.1
Address:        127.0.0.1#53

** server can't find googleadservices.com: NXDOMAIN
** server can't find googleadservices.com: NXDOMAIN
root@OpenWrt:~# nslookup www.googleadservices.com
Server:         127.0.0.1
Address:        127.0.0.1#53

** server can't find www.googleadservices.com: NXDOMAIN
** server can't find www.googleadservices.com: NXDOMAIN
root@OpenWrt:~# /etc/init.d/simple-adblock check www.googleadservices.com
The www.googleadservices.com is not found in current blacklist.
root@OpenWrt:~# uci show simple-adblock
root@OpenWrt:~# uci show simple-adblock
simple-adblock.config=simple-adblock
simple-adblock.config.verbosity='2'
simple-adblock.config.force_dns='1'
simple-adblock.config.hosts_file='/var/dnsmasq.d/simple-adblock'
simple-adblock.config.blacklist_hosts_url='http://www.mvps.org/winhelp2002/hosts.txt' 'http://pgl.yoyo.org/as/serverlist.php?hostformat=hosts&showintro=1&mimetype=plaintext' 'http://www.malwaredomainlist.com/hostslist/hosts.txt' 'https://adaway.org/hosts.txt' 'http://someonewhocares.org/hosts/hosts' 'https://raw.githubusercontent.com/hoshsadiq/adblock-nocoin-list/master/hosts.txt' 'https://zeustracker.abuse.ch/blocklist.php?download=hostfile'
simple-adblock.config.blacklist_domains_url='http://mirror1.malwaredomains.com/files/justdomains' 'https://s3.amazonaws.com/lists.disconnect.me/simple_malvertising.txt' 'https://s3.amazonaws.com/lists.disconnect.me/simple_ad.txt' 'https://s3.amazonaws.com/lists.disconnect.me/simple_tracking.txt' 'https://ransomwaretracker.abuse.ch/downloads/RW_DOMBL.txt' 'https://ssl.bblck.me/blacklists/domain-list.txt' 'http://dshield.org/feeds/suspiciousdomains_High.txt'
simple-adblock.config.boot_delay='120'
simple-adblock.config.download_timeout='10'
simple-adblock.config.enabled='1'
simple-adblock.config.whitelist_domain='raw.githubusercontent.com' 'https://www.googleadservices.com' 'http://www.googleadservices.com' 'https://googleadservices.com' 'http://googleadservices.com' 'googleadservices.com' 'www.googleadservices.com'

Please upgrade to latest from my repo.

Can you try to reboot your router?

I have rebooted, same result unfortunately.

grep googleadservices /var/dnsmasq.d/simple-adblock
?

root@OpenWrt:~# grep googleadservices /var/dnsmasq.d/simple-adblock
local=/googleadservices.com/

How do I correct this / how does the whitelist come into play?

Add the following line in /etc/config/simple-adblock

list whitelist_domain 'googleadservices.com'

You can also add the same in luci-app.

It's already there. I added that whitelist via web UI but for some reason it's still being blocked.

Did you restart the simple-adblock service?
If you run the nslookup/dig what does it return?

hm, when rebooting the router from the UI I have had no luck. I just ran a reboot through ssh and the whitelist appears to be working now.

No need to reboot the router, it is not running Windows :stuck_out_tongue:
/etc/init.d/simple-adblock restart
will do just fine ( or System-Startup in Luci)

@stangri
Need help to run luci-app-simple-adblock on barrier breaker (BB).
I built the luci-app-simple-adblock package using BB SDK. Installs fine, appears in luci->services menu as well.
However when I click on it, it throws error:

/usr/lib/lua/luci/dispatcher.lua:461: Failed to execute cbi dispatcher target for entry '/admin/services/simple-adblock'. The called action terminated with an exception: /usr/lib/lua/luci/model/cbi/simple-adblock.lua:12: attempt to call field 'ubus' (a nil value) stack traceback: [C]: in function 'assert' /usr/lib/lua/luci/dispatcher.lua:461: in function 'dispatch' /usr/lib/lua/luci/dispatcher.lua:195: in function </usr/lib/lua/luci/dispatcher.lua:194>

If BB doesn't have luci.util.ubus, I don't know how to help you.

Check the source repo for the version of the luci app before I've implemented ubus support in it.

PS. Why is it on line 12? Where did you grab the source file from? Did you modify it in any way?

Have not modified source code.
I am using latest, cloned from "openwrt packages" repo.

First ubus mention I see in in git log: "store status in ubus; parallel downloads;"
Do you mean to say, i should use commit hash 454f321cde5?

commit 75d1705e3ae53900b3eb89c076d5f80e5a0fbbcd
Author: Stan Grishin stangri@melmac.net
Date: Sun Jun 24 17:42:28 2018 -0700

simple-adblock: store status in ubus; parallel downloads;

Signed-off-by: Stan Grishin <stangri@melmac.net>

commit 454f321cde5a1558826b688133cbf647cc1221a3
Author: Stan Grishin stangri@melmac.net
Date: Mon Jun 18 09:57:26 2018 -0700

fakeinternet: cosmetic changes

Signed-off-by: Stan Grishin <stangri@melmac.net>

commit 00463317ebe65b1ad1d4d222cb362cff7f272be6
Author: Stan Grishin stangri@melmac.net
Date: Mon Jun 18 09:54:45 2018 -0700

fakeinternet: strip unused ipt/iptables code 

Signed-off-by: Stan Grishin <stangri@melmac.net>

Would it be a good idea to use nice to limit the CPU time that this program has?

Just quickly read this thread and trying to understand what the difference between simple-adblock and the other adblock: they see to be using the same blacklists so functionally are the same. Am I wrong?

Totally would be. The downloading and processing of each list is spun into a separate process and I haven't figured out the way to make nice work with them.

There was an overview of differences. This one can only process simpler lists, but is much faster due to that, fully UCI-controllable (no manual editing of config files) and the lists can be easily added/deleted from WebUI. You can also choose to keep compressed blacklists cache which survives router reboots.

The adblock package has more complex code with custom processing filters for additional block-lists which simple-adblock cannot process.

Still Ads exist on youtube and some website after last firmware update!
Any new fix for that?

Regards

You will never be able to get rid of all ads, simple-adblock merely works on a DNS basis depending on externally curated blocklists. These blocklists will never cover all hosts serving ads - and especially google/ youtube are increasingly serving content and ads from the same domain/ server, making DNS based blocking ineffective.

Hello,

sadly I'm not able to get simple-adblock up and running with the default configuration.

Following error is shown when simple-adblock is run the second time:
ERROR: simple-adblock 1.6.3-5 failed to create its data file!

I downloaded all prerequisites for OpenWRT 18.06 and installed simple-adblock afterwards:

opkg update
opkg install uclient-fetch libustream-mbedtls coreutils-sort dnsmasq-full
opkg install simple-adblock luci-app-simple-adblock

Then I enabled the service and started it:

uci set simple-adblock.config.enabled='1'
/etc/init.d/simple-adblock start

At this moment, simple-adblock tries to download the first filter lists.

[DL] Blocked Domains: s3.amazonaws.com [✗]
[DL] Blocked Domains: s3.amazonaws.com [✗]
[DL] Blocked Domains: s3.amazonaws.com [✗]
[DL] Blocked Hosts: raw.githubusercontent.com [✓]
[DL] Blocked Domains: ssl.bblck.me [✓]
[DL] Blocked Hosts: adaway.org [✓]
[DL] Blocked Hosts: zeustracker.abuse.ch [✓]
[DL] Blocked Domains: ransomwaretracker.abuse.ch [✓]
[DL] Blocked Hosts: www.malwaredomainlist.com [✓]
[DL] Blocked Domains: dshield.org [✓]
[DL] Blocked Domains: mirror1.malwaredomains.com [✓]
[DL] Blocked Hosts: www.mvps.org [✓]
[DL] Blocked Hosts: pgl.yoyo.org [✗]
[DL] Blocked Hosts: someonewhocares.org [✓]
Sorting combined list [✓]
Optimizing combined list [✓]
Whitelisting domains [✓]
Formatting merged file [✓]
Creating dnsmasq config [✓]
Removing temporary files [✓]
Restarting dnsmasq [✓]

When clicking refresh on the LUCI GUI or re-running the service via /etc/init.d/simple-adblock start or /etc/init.d/simple-adblock reload, I get following issue:

Reloading simple-adblock 1.6.3-5...
[DL] Blocked Domains: mirror1.malwaredomains.com [✗]
[DL] Blocked Domains: dshield.org [✗]
[DL] Blocked Hosts: raw.githubusercontent.com [✗]
[DL] Blocked Hosts: www.mvps.org [✗]
[DL] Blocked Domains: ransomwaretracker.abuse.ch [✗]
[DL] Blocked Domains: ssl.bblck.me [✗]
[DL] Blocked Hosts: www.malwaredomainlist.com [✗]
[DL] Blocked Hosts: adaway.org [✗]
[DL] Blocked Hosts: someonewhocares.org [✗]
[DL] Blocked Hosts: zeustracker.abuse.ch [✗]
ERROR: simple-adblock 1.6.3-5 failed to create its data file!
root@OpenWrt:~# /etc/init.d/simple-adblock reload
Reloading simple-adblock 1.6.3-5...
[DL] Blocked Hosts: www.malwaredomainlist.com [✗]
[DL] Blocked Hosts: someonewhocares.org [✗]
[DL] Blocked Domains: mirror1.malwaredomains.com [✗]
[DL] Blocked Hosts: www.mvps.org [✗]
[DL] Blocked Hosts: raw.githubusercontent.com [✗]
[DL] Blocked Hosts: zeustracker.abuse.ch [✗]
[DL] Blocked Hosts: adaway.org [✗]
[DL] Blocked Domains: ssl.bblck.me [✗]
[DL] Blocked Domains: ransomwaretracker.abuse.ch [✗]
[DL] Blocked Domains: dshield.org [✗]

Then the error message is appended:
ERROR: simple-adblock 1.6.3-5 failed to create its data file!

When simple-adblock runs the second time, everything seems broken.
It somehow can't write to it's data file.

Does someone know the issue?

What does uci show simple-adblock report?