adblock: release 4.4.0-1

* added a 'DNS Shift' option, where the generated final DNS blocklist is moved to the backup directory and
   only a soft link to this file is set in memory. As long as your backup directory is located on an external drive,
   you should activate this option to save disk space
* added ETAG-Header support to make sure to download only feeds that has been changed,
   use backups otherwise (not supported by uclient-fetch)
* removed aria2 support
* added brave as a new safesearch provider
* removed the racist terminology from the local lists and renamed it to "allowlist" and "blocklist"
* removed the 'list' and 'timer' function from init, use the LuCI feed editor and the standard cron frontend instead
* various  code changes and improvements
* major LuCI frontend changes, incl. a custom feed editor (separate commit)
* partial readme update

Signed-off-by: Dirk Brenken <dev@brenken.org>
This commit is contained in:
Dirk Brenken
2025-04-10 23:39:08 +02:00
parent 3764639cae
commit 4857db8e28
9 changed files with 485 additions and 618 deletions

View File

@@ -1,4 +1,4 @@
#
# dns based ad/abuse domain blocking
# Copyright (c) 2015-2025 Dirk Brenken (dev@brenken.org)
# This is free software, licensed under the GNU General Public License v3.
#
@@ -6,8 +6,8 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=adblock
PKG_VERSION:=4.2.7
PKG_RELEASE:=3
PKG_VERSION:=4.4.0
PKG_RELEASE:=1
PKG_LICENSE:=GPL-3.0-or-later
PKG_MAINTAINER:=Dirk Brenken <dev@brenken.org>
@@ -16,22 +16,23 @@ include $(INCLUDE_DIR)/package.mk
define Package/adblock
SECTION:=net
CATEGORY:=Network
TITLE:=Powerful adblock script to block ad/abuse domains by using DNS
TITLE:=adblock blocks ad/abuse domains by using DNS
DEPENDS:=+jshn +jsonfilter +coreutils +coreutils-sort +gawk +ca-bundle +rpcd +rpcd-mod-rpcsys
PKGARCH:=all
endef
define Package/adblock/description
Powerful adblock solution to block ad/abuse domains via dnsmasq, unbound, named, smartdns or kresd.
The script supports many domain blacklist sites plus manual black- and whitelist overrides.
adblock blocks ad/abuse domains via dnsmasq, unbound, named, smartdns or kresd.
adblock supports many domain blocklist sites plus local block- and allowlist overrides.
Please see https://github.com/openwrt/packages/blob/master/net/adblock/files/README.md for further information.
endef
define Package/adblock/conffiles
/etc/config/adblock
/etc/adblock/adblock.whitelist
/etc/adblock/adblock.blacklist
/etc/adblock/adblock.allowlist
/etc/adblock/adblock.blocklist
/etc/adblock/adblock.custom.feeds
endef
define Build/Prepare
@@ -55,11 +56,11 @@ define Package/adblock/install
$(INSTALL_DIR) $(1)/etc/adblock
$(INSTALL_BIN) ./files/adblock.mail $(1)/etc/adblock
$(INSTALL_CONF) ./files/adblock.blacklist $(1)/etc/adblock
$(INSTALL_CONF) ./files/adblock.whitelist $(1)/etc/adblock
$(INSTALL_CONF) ./files/adblock.allowlist $(1)/etc/adblock
$(INSTALL_CONF) ./files/adblock.blocklist $(1)/etc/adblock
$(INSTALL_CONF) ./files/adblock.categories $(1)/etc/adblock
$(INSTALL_CONF) ./files/adblock.sources $(1)/etc/adblock
gzip -9n $(1)/etc/adblock/adblock.sources
$(INSTALL_CONF) ./files/adblock.feeds $(1)/etc/adblock
$(INSTALL_CONF) ./files/adblock.custom.feeds $(1)/etc/adblock
endef
$(eval $(call BuildPackage,adblock))

View File

@@ -2,13 +2,15 @@
# DNS based ad/abuse domain blocking
<a id="description"></a>
## Description
A lot of people already use adblocker plugins within their desktop browsers, but what if you are using your (smart) phone, tablet, watch or any other (wlan) gadget!? Getting rid of annoying ads, trackers and other abuse sites (like facebook) is simple: block them with your router. When the DNS server on your router receives DNS requests, you will sort out queries that ask for the resource records of ad servers and return a simple 'NXDOMAIN'. This is nothing but **N**on-e**X**istent Internet or Intranet domain name, if domain name is unable to resolved using the DNS server, a condition called the 'NXDOMAIN' occurred.
<a id="main-features"></a>
## Main Features
* Support of the following fully pre-configured domain blocklist sources (free for private usage, for commercial use please check their individual licenses)
* Support of the following fully pre-configured domain blocklist feeds (free for private usage, for commercial use please check their individual licenses)
| Source | Enabled | Size | Focus | Information |
| Feed | Enabled | Size | Focus | Information |
| :------------------ | :-----: | :--- | :--------------- | :-------------------------------------------------------------------------------- |
| 1Hosts | | VAR | compilation | [Link](https://github.com/badmojr/1Hosts) |
| adaway | | S | mobile | [Link](https://github.com/AdAway/adaway.github.io) |
@@ -68,55 +70,57 @@ A lot of people already use adblocker plugins within their desktop browsers, but
| winspy | | S | win_telemetry | [Link](https://github.com/crazy-max/WindowsSpyBlocker) |
| yoyo | | S | general | [Link](https://pgl.yoyo.org/adservers) |
* List of supported and fully pre-configured adblock sources, already active sources are pre-selected.
<b><em>To avoid OOM errors, please do not select too many lists!</em></b>
List size information with the respective domain ranges as follows:
• <b>S</b> (-10k), <b>M</b> (10k-30k) and <b>L</b> (30k-80k) should work for 128 MByte devices,
• <b>XL</b> (80k-200k) should work for 256-512 MByte devices,
• <b>XXL</b> (200k-) needs more RAM and Multicore support, e.g. x86 or raspberry devices.
• <b>VAR</b> (50k-900k) variable size depending on the selection.
* List of supported and fully pre-configured adblock sources, already active sources are pre-selected.
<b><em>To avoid OOM errors, please do not select too many lists!</em></b>
List size information with the respective domain ranges as follows:
• <b>S</b> (-10k), <b>M</b> (10k-30k) and <b>L</b> (30k-80k) should work for 128 MByte devices
• <b>XL</b> (80k-200k) should work for 256-512 MByte devices
• <b>XXL</b> (200k-) needs more RAM and Multicore support, e.g. x86 or raspberry devices
• <b>VAR</b> (50k-900k) variable size depending on the selection
* Zero-conf like automatic installation & setup, usually no manual changes needed
* Simple but yet powerful adblock engine: adblock does not use error prone external iptables rulesets, http pixel server instances and things like that
* Supports six different DNS backend formats: dnsmasq, unbound, named (bind), kresd, smartdns or raw (e.g. used by dnscrypt-proxy)
* Supports four different SSL-enabled download utilities: uclient-fetch, wget, curl or aria2c
* Supports SafeSearch for google, bing, duckduckgo, yandex, youtube and pixabay
* Supports three different SSL-enabled download utilities: uclient-fetch, full wget or curl
* Supports SafeSearch for google, bing, brave, duckduckgo, yandex, youtube and pixabay
* Supports RPZ-trigger 'RPZ-CLIENT-IP' to always allow/deny certain DNS clients based on their IP address (currently only supported by bind dns backend)
* Fast downloads & list processing as they are handled in parallel running background jobs with multicore support
* The download engine supports ETAG headers to download only updated feeds
* Supports a wide range of router modes, even AP modes are supported
* Full IPv4 and IPv6 support
* Provides top level domain compression ('tld compression'), this feature removes thousands of needless host entries from the blocklist and lowers the memory footprint for the DNS backend
* Provides a 'DNS File Reset', where the generated DNS blocklist file will be purged after DNS backend loading to save storage space
* Source parsing by fast & flexible regex rulesets, all rules and source information are placed in an external/compredd JSON file ('/etc/adblock/adblock.sources.gz')
* Provides a 'DNS Shift', where the generated final DNS blocklist is moved to the backup directory and only a soft link to this file is set in memory. As long as your backup directory is located on an external drive, you should activate this option to save disk space.
* Source parsing by fast & flexible regex rulesets, all rules and feed information are placed in an external JSON file ('/etc/adblock/adblock.feeds')
* Overall duplicate removal in generated blocklist file 'adb_list.overall'
* Additional local blacklist for manual overrides, located in '/etc/adblock/adblock.blacklist'
* Additional local whitelist for manual overrides, located in '/etc/adblock/adblock.whitelist'
* Additional local blocklist for manual overrides, located in '/etc/adblock/adblock.blocklist'
* Additional local allowlist for manual overrides, located in '/etc/adblock/adblock.allowlist'
* Quality checks during blocklist update to ensure a reliable DNS backend service
* Minimal status & error logging to syslog, enable debug logging to receive more output
* Procd based init system support ('start', 'stop', 'restart', 'reload', 'enable', 'disable', 'running', 'status', 'suspend', 'resume', 'query', 'report', 'list', 'timer')
* Procd based init system support ('start', 'stop', 'restart', 'reload', 'enable', 'disable', 'running', 'status', 'suspend', 'resume', 'query', 'report')
* Auto-Startup via procd network interface trigger or via classic time based startup
* Suspend & Resume adblock temporarily without blocklist reloading
* Suspend & Resume adblock temporarily without blocklist re-processing
* Provides comprehensive runtime information
* Provides a detailed DNS Query Report with DNS related information about client requests, top (blocked) domains and more
* Provides a powerful query function to quickly find blocked (sub-)domains, e.g. for whitelisting
* Provides an easily configurable blocklist update scheduler called 'Refresh Timer'
* Provides a powerful query function to quickly find blocked (sub-)domains, e.g. to allow certain domains
* Includes an option to generate an additional, restrictive 'adb_list.jail' to block access to all domains except those listed in the whitelist file. You can use this restrictive blocklist manually e.g. for guest wifi or kidsafe configurations
* Includes an option to force DNS requests to the local resolver
* Automatic blocklist backup & restore, these backups will be used in case of download errors and during startup
* Send notification E-Mails in case of a processing error or if the overall domain count is &le; 0
* Add new adblock sources on your own, see example below
* Send notification E-Mails, see example configuration below
* Add new adblock feeds on your own, see example below
* Strong LuCI support, all relevant options are exposed to the web frontend
<a id="prerequisites"></a>
## Prerequisites
* [OpenWrt](https://openwrt.org), tested with the stable release series and with the latest snapshot releases.
<b>Please note:</b> Devices with less than 128 MByte RAM are _not_ supported!
<b>Please note:</b> For performance reasons, adblock depends on gnu awk (gawk) by default.
If you insist to use the slow busybox awk implementation, remove the gawk package afterwards (_opkg remove gawk --force-depends_) or install adblock without any dependency checks/installation (_opkg install adblock --nodeps_). Both installation variants are officially unsupported.
* [OpenWrt](https://openwrt.org), tested with the stable release series and with the latest snapshot releases.
<b>Please note:</b> Devices with less than 128 MByte RAM are _not_ supported!
<b>Please note:</b> For performance reasons, adblock depends on gnu awk (gawk) by default.
If you insist to use the slow busybox awk implementation, remove the gawk package afterwards (_opkg remove gawk --force-depends_) or install adblock without any dependency checks/installation (_opkg install adblock --nodeps_). Both installation variants are officially unsupported.
* A usual setup with an enabled DNS backend at minimum - dumb AP modes without a working DNS backend are _not_ supported
* A download utility with SSL support: 'wget', 'uclient-fetch' with one of the 'libustream-*' ssl libraries, 'aria2c' or 'curl' is required
* A download utility with SSL support: 'wget', 'uclient-fetch' with one of the 'libustream-*' ssl libraries or 'curl' is required
* A certificate store such as 'ca-bundle' or 'ca-certificates', as adblock checks the validity of the SSL certificates of all download sites by default
* Optional E-Mail notification support: for E-Mail notifications you need to install the additional 'msmtp' package
* Optional DNS Query Report support: for DNS reporting you need to install the additional package 'tcpdump-mini' or 'tcpdump'
<a id="installation-and-usage"></a>
## Installation & Usage
* Update your local opkg repository (_opkg update_)
* Install 'adblock' (_opkg install adblock_). The adblock service is enabled by default
@@ -124,10 +128,12 @@ A lot of people already use adblocker plugins within their desktop browsers, but
* It's strongly recommended to use the LuCI frontend to easily configure all aspects of adblock, the application is located in LuCI under the 'Services' menu
* Update from a former adblock version is easy. During the update a backup is made of the old configuration '/etc/config/adblock-backup' and replaced by the new config - that's all
## Adblock CLI Options
<a id="adblock-cli-interface"></a>
## Adblock CLI interface
* All important adblock functions are accessible via CLI as well.
<pre><code>
~# /etc/init.d/adblock
```
~# /etc/init.d/adblock
Syntax: /etc/init.d/adblock [command]
Available commands:
@@ -140,26 +146,24 @@ Available commands:
enabled Check if service is started on boot
suspend Suspend adblock processing
resume Resume adblock processing
query &lt;domain&gt; Query active blocklists and backups for a specific domain
report [&lt;search&gt;] Print DNS statistics with an optional search parameter
list List available sources
timer [&lt;add&gt; &lt;tasks&gt; &lt;hour&gt; [&lt;minute&gt;] [&lt;weekday&gt;]]|[&lt;remove&gt; &lt;line no.&gt;] List/Edit cron update intervals
version Print version information
query <domain> Query active blocklists and backups for a specific domain
report [<cli>|<mail>|<gen>|<json>] Print DNS statistics
running Check if service is running
status Service status
trace Start with syscall trace
</code></pre>
info Dump procd service info
```
<a id="adblock-config-options"></a>
## Adblock Config Options
* Usually the auto pre-configured adblock setup works quite well and no manual overrides are needed
| Option | Default | Description/Valid Values |
| :----------------- | :--------------------------------- | :--------------------------------------------------------------------------------------------- |
| adb_enabled | 1, enabled | set to 0 to disable the adblock service |
| adb_srcarc | -, /etc/adblock/adblock.sources.gz | full path to the used adblock source archive |
| adb_srcfile | -, /tmp/adb_sources.json | full path to the used adblock source file, which has a higher precedence than the archive file |
| adb_feedfile | /etc/adblock/adblock.feeds | full path to the used adblock feed file |
| adb_dns | -, auto-detected | 'dnsmasq', 'unbound', 'named', 'kresd', 'smartdns' or 'raw' |
| adb_fetchutil | -, auto-detected | 'uclient-fetch', 'wget', 'curl' or 'aria2c' |
| adb_fetchutil | -, auto-detected | 'uclient-fetch', 'wget' or 'curl' |
| adb_fetchparm | -, auto-detected | manually override the config options for the selected download utility |
| adb_fetchinsecure | 0, disabled | don't check SSL server certificates during download |
| adb_trigger | -, not set | trigger network interface or 'not set' to use a time-based startup |
@@ -181,13 +185,11 @@ Available commands:
| adb_repchunkcnt | 5 | report chunk count used by tcpdump |
| adb_repchunksize | 1 | report chunk size used by tcpdump in MB |
| adb_represolve | 0, disabled | resolve reporting IP addresses using reverse DNS (PTR) lookups |
| adb_backup | 1, enabled | set to 0 to disable the backup function |
| adb_tld | 1, enabled | set to 0 to disable the top level domain compression (tld) function |
| adb_backupdir | /tmp | path for adblock backups |
| adb_tmpbase | /tmp | path for all adblock related runtime operations, e.g. downloading, sorting, merging etc. |
| adb_safesearch | 0, disabled | set to 1 to enforce SafeSearch for google, bing, duckduckgo, yandex, youtube and pixabay |
| adb_safesearch | 0, disabled | enforce SafeSearch for google, bing, brave, duckduckgo, yandex, youtube and pixabay |
| adb_safesearchlist | -, not set | Limit SafeSearch to certain provider (see above) |
| adb_safesearchmod | 0, disabled | set to 1 to enable moderate SafeSearch filters for youtube |
| adb_mail | 0, disabled | set to 1 to enable notification E-Mails in case of a processing errors |
| adb_mailreceiver | -, not set | receiver address for adblock notification E-Mails |
| adb_mailsender | no-reply@adblock | sender address for adblock notification E-Mails |
@@ -196,6 +198,7 @@ Available commands:
| adb_jail | 0 | set to 1 to enable the additional, restrictive 'adb_list.jail' creation |
| adb_jaildir | /tmp | path for the generated jail list |
<a id="examples"></a>
## Examples
**Change the DNS backend to 'unbound':**
No further configuration is needed, adblock deposits the final blocklist 'adb_list.overall' in '/var/lib/unbound' by default.
@@ -205,7 +208,8 @@ To preserve the DNS cache after adblock processing please install the additional
Adblock deposits the final blocklist 'adb_list.overall' in '/var/lib/bind' by default.
To preserve the DNS cache after adblock processing please install the additional package 'bind-rdnc'.
To use the blocklist please modify '/etc/bind/named.conf':
<pre><code>
```
in the 'options' namespace add:
response-policy { zone "rpz"; };
@@ -216,7 +220,7 @@ and at the end of the file add:
allow-query { none; };
allow-transfer { none; };
};
</code></pre>
```
**Change the DNS backend to 'kresd':**
Adblock deposits the final blocklist 'adb_list.overall' in '/etc/kresd', no further configuration needed.
@@ -230,10 +234,9 @@ You can enable a restrictive 'adb_list.jail' to block access to all domains exce
**Manually override the download options:**
By default adblock uses the following pre-configured download options:
* aria2c: <code>--timeout=20 --allow-overwrite=true --auto-file-renaming=false --log-level=warn --dir=/ -o</code>
* curl: <code>--connect-timeout 20 --silent --show-error --location -o</code>
* uclient-fetch: <code>--timeout=20 -O</code>
* wget: <code>--no-cache --no-cookies --max-redirect=0 --timeout=20 -O</code>
* <code>curl: --connect-timeout 20 --silent --show-error --location -o</code>
* <code>uclient-fetch: --timeout=20 -O</code>
* <code>wget: --no-cache --no-cookies --max-redirect=0 --timeout=20 -O</code>
To override the default set 'adb_fetchparm' manually to your needs.
@@ -261,60 +264,39 @@ Finally enable E-Mail support and add a valid E-Mail receiver address in LuCI.
**Service status output:**
In LuCI you'll see the realtime status in the 'Runtime' section on the overview page.
To get the status in the CLI, just call _/etc/init.d/adblock status_ or _/etc/init.d/adblock status\_service_:
<pre><code>
```
~#@blackhole:~# /etc/init.d/adblock status
::: adblock runtime information
+ adblock_status : enabled
+ adblock_version : 4.2.3-r1
+ blocked_domains : 785573
+ active_sources : adguard, doh_blocklist, hagezi, winspy
+ dns_backend : dnsmasq (-), /tmp/dnsmasq.d
+ adblock_version : 4.4.0-r1
+ blocked_domains : 1 154 208
+ active_feeds : 1hosts, certpl, cpbl, doh_blocklist, hagezi, winspy
+ dns_backend : dnsmasq (-), /mnt/data/adblock/backup, 92.87 MB
+ run_utils : download: /usr/bin/curl, sort: /usr/libexec/sort-coreutils, awk: /usr/bin/gawk
+ run_ifaces : trigger: trm_wwan, report: br-lan
+ run_directories : base: /tmp, backup: /tmp/adblock-Backup, report: /tmp/adblock-Report, jail: /tmp
+ run_flags : backup: ✔, tld: ✔, force: ✔, flush: ✘, search: ✘, report: ✔, mail: ✘, jail: ✘
+ last_run : reload, 1m 3s, 650 MB available, 1664 KB max. used, 2024-11-23T18:11:41+01:00
+ system : OpenWrt One, mediatek/filogic, OpenWrt SNAPSHOT r28034-ca53f2d430
</code></pre>
The 'last\_run' line includes the used start type, the run duration, the memory footprint after DNS backend loading (total/free/available) and the date/time of the last run.
+ run_directories : base: /mnt/data/adblock, backup: /mnt/data/adblock/backup, report: /mnt/data/adblock/report, jail: -
+ run_flags : shift: ✔, force: ✔, flush: ✘, tld: ✔, search: ✘, report: ✔, mail: ✘, jail: ✘
+ last_run : mode: reload, 2025-04-10T20:34:17+02:00, duration: 0m 55s, 682.52 MB available
+ system_info : OpenWrt One, mediatek/filogic, OpenWrt 24.10-SNAPSHOT r28584-a51b1a98e0
```
**Edit, add new adblock sources:**
The adblock blocklist sources are stored in an external, compressed JSON file '/etc/adblock/adblock.sources.gz'.
This file is directly parsed in LuCI and accessible via CLI, just call _/etc/init.d/adblock list_:
<pre><code>
/etc/init.d/adblock list
::: Available adblock sources
:::
Name Enabled Size Focus Info URL
------------------------------------------------------------------
+ adaway x S mobile https://adaway.org
+ adguard x L general https://adguard.com
+ andryou x L compilation https://gitlab.com/andryou/block/-/blob/master/readme.md
+ bitcoin x S mining https://github.com/hoshsadiq/adblock-nocoin-list
+ disconnect x S general https://disconnect.me
+ dshield XL general https://www.dshield.org
[...]
+ winhelp S general http://winhelp2002.mvps.org
+ winspy x S win_telemetry https://github.com/crazy-max/WindowsSpyBlocker
+ yoyo x S general https://pgl.yoyo.org
</code></pre>
**Change/add adblock feeds**
The adblock default blocklist feeds are stored in an external JSON file '/etc/adblock/adblock.feeds'. All custom changes should be stored in an external JSON file '/etc/adblock/adblock.custom.feeds' (empty by default). It's recommended to use the LuCI based Custom Feed Editor to make changes to this file.
A valid JSON source object contains the following information, e.g.:
To add new or edit existing sources extract the compressed JSON file _gunzip /etc/adblock/adblock.sources.gz_.
A valid JSON source object contains the following required information, e.g.:
<pre><code>
```
[...]
"adaway": {
"url": "https://raw.githubusercontent.com/AdAway/adaway.github.io/master/hosts.txt",
"rule": "/^127\\.0\\.0\\.1[[:space:]]+([[:alnum:]_-]+\\.)+[[:alpha:]]+([[:space:]]|$)/{print tolower($2)}",
"size": "S",
"focus": "mobile",
"descurl": "https://github.com/AdAway/adaway.github.io"
"adguard": {
"url": "https://adguardteam.github.io/AdGuardSDNSFilter/Filters/filter.txt",
"rule": "BEGIN{FS=\"[|^]\"}/^\\|\\|([[:alnum:]_-]{1,63}\\.)+[[:alpha:]]+\\^(\\$third-party)?$/{print tolower($3)}",
"size": "L",
"descr": "general"
},
[...]
</code></pre>
Add an unique object name, make the required changes to 'url', 'rule', 'size' and 'descurl' and finally compress the changed JSON file _gzip /etc/adblock/adblock.sources_ to use the new source object in adblock.
<b>Please note:</b> if you're going to add new sources on your own, please make a copy of the default file and work with that copy further on, cause the default will be overwritten with every adblock update. To reference your copy set the option 'adb\_srcarc' which points by default to '/etc/adblock/adblock.sources.gz'
<b>Please note:</b> when adblock starts, it looks for the uncompressed 'adb\_srcfile', only if this file is not found the archive 'adb\_srcarc' is unpacked once and then the uncompressed file is used
```
Add an unique feed name (no spaces, no special chars) and make the required changes: adapt at least the URL, the regex rule, the size and the description for a new feed.
## Support
Please join the adblock discussion in this [forum thread](https://forum.openwrt.org/t/adblock-support-thread/507) or contact me by mail <dev@brenken.org>

View File

@@ -4,8 +4,6 @@ config adblock 'global'
option adb_debug '0'
option adb_forcedns '0'
option adb_safesearch '0'
option adb_dnsfilereset '0'
option adb_mail '0'
option adb_report '0'
option adb_backup '1'
list adb_sources 'adguard'
list adb_feed 'adguard'

View File

View File

@@ -3,399 +3,342 @@
"url": "https://raw.githubusercontent.com/badmojr/1Hosts/master/",
"rule": "/^([[:alnum:]_-]{1,63}\\.)+[[:alpha:]]+([[:space:]]|$)/{print tolower($1)}",
"size": "VAR",
"focus": "compilation",
"descurl": "https://github.com/badmojr/1Hosts"
"descr": "compilation"
},
"adaway": {
"url": "https://raw.githubusercontent.com/AdAway/adaway.github.io/master/hosts.txt",
"rule": "/^127\\.0\\.0\\.1[[:space:]]+([[:alnum:]_-]{1,63}\\.)+[[:alpha:]]+([[:space:]]|$)/{print tolower($2)}",
"size": "S",
"focus": "mobile",
"descurl": "https://github.com/AdAway/adaway.github.io"
"descr": "mobile"
},
"adguard": {
"url": "https://adguardteam.github.io/AdGuardSDNSFilter/Filters/filter.txt",
"rule": "BEGIN{FS=\"[\/|^|\\r]\"}/^\\|\\|([[:alnum:]_-]{1,63}\\.)+[[:alpha:]]+[\\/\\^\\r]+$/{print tolower($3)}",
"rule": "BEGIN{FS=\"[|^]\"}/^\\|\\|([[:alnum:]_-]{1,63}\\.)+[[:alpha:]]+\\^(\\$third-party)?$/{print tolower($3)}",
"size": "L",
"focus": "general",
"descurl": "https://adguard.com"
"descr": "general"
},
"adguard_tracking": {
"url": "https://raw.githubusercontent.com/AdguardTeam/cname-trackers/master/data/combined_disguised_trackers_justdomains.txt",
"rule": "/^([[:alnum:]_-]{1,63}\\.)+[[:alpha:]]+([[:space:]]|$)/{print tolower($1)}",
"size": "L",
"focus": "tracking",
"descurl": "https://github.com/AdguardTeam/cname-trackers"
"descr": "tracking"
},
"android_tracking": {
"url": "https://raw.githubusercontent.com/Perflyst/PiHoleBlocklist/master/android-tracking.txt",
"rule": "/^([[:alnum:]_-]{1,63}\\.)+[[:alpha:]]+([[:space:]]|$)/{print tolower($1)}",
"size": "S",
"focus": "tracking",
"descurl": "https://github.com/Perflyst/PiHoleBlocklist"
"descr": "tracking"
},
"andryou": {
"url": "https://gitlab.com/andryou/block/raw/master/kouhai-compressed-domains",
"rule": "/^([[:alnum:]_-]{1,63}\\.)+[[:alpha:]]+([[:space:]]|$)/{print tolower($1)}",
"size": "L",
"focus": "compilation",
"descurl": "https://gitlab.com/andryou/block/-/blob/master/readme.md"
"descr": "compilation"
},
"anti_ad": {
"url": "https://raw.githubusercontent.com/privacy-protection-tools/anti-AD/master/anti-ad-domains.txt",
"rule": "/^([[:alnum:]_-]{1,63}\\.)+[[:alpha:]]+([[:space:]]|$)/{print tolower($1)}",
"size": "L",
"focus": "compilation",
"descurl": "https://github.com/privacy-protection-tools/anti-AD/blob/master/README.md"
"descr": "compilation"
},
"anudeep": {
"url": "https://raw.githubusercontent.com/anudeepND/blacklist/master/adservers.txt",
"rule": "/^0\\.0\\.0\\.0[[:space:]]+([[:alnum:]_-]{1,63}\\.)+[[:alpha:]]+([[:space:]]|$)/{print tolower($2)}",
"size": "M",
"focus": "compilation",
"descurl": "https://github.com/anudeepND/blacklist"
"descr": "compilation"
},
"bitcoin": {
"url": "https://raw.githubusercontent.com/hoshsadiq/adblock-nocoin-list/master/hosts.txt",
"rule": "/^0\\.0\\.0\\.0[[:space:]]+([[:alnum:]_-]{1,63}\\.)+[[:alpha:]]+([[:space:]]|$)/{print tolower($2)}",
"size": "S",
"focus": "mining",
"descurl": "https://github.com/hoshsadiq/adblock-nocoin-list"
"descr": "mining"
},
"certpl": {
"url": "https://hole.cert.pl/domains/v2/domains.txt",
"rule": "/^([[:alnum:]_-]{1,63}\\.)+[[:alpha:]]+([[:space:]]|$)/{print tolower($1)}",
"size": "L",
"focus": "phishing",
"descurl": "https://cert.pl"
"descr": "phishing"
},
"cpbl": {
"url": "https://raw.githubusercontent.com/bongochong/CombinedPrivacyBlockLists/master/NoFormatting/cpbl-ctld.txt",
"rule": "/^([[:alnum:]_-]{1,63}\\.)+[[:alpha:]]+([[:space:]]|$)/{print tolower($1)}",
"size": "XL",
"focus": "compilation",
"descurl": "https://github.com/bongochong/CombinedPrivacyBlockLists"
"descr": "compilation"
},
"disconnect": {
"url": "https://s3.amazonaws.com/lists.disconnect.me/simple_malvertising.txt",
"rule": "/^([[:alnum:]_-]{1,63}\\.)+[[:alpha:]]+([[:space:]]|$)/{print tolower($1)}",
"size": "S",
"focus": "general",
"descurl": "https://disconnect.me"
"descr": "general"
},
"doh_blocklist": {
"url": "https://raw.githubusercontent.com/dibdot/DoH-IP-blocklists/master/doh-domains_overall.txt",
"rule": "/^([[:alnum:]_-]{1,63}\\.)+[[:alpha:]]+([[:space:]]|$)/{print tolower($1)}",
"size": "S",
"focus": "doh_server",
"descurl": "https://github.com/dibdot/DoH-IP-blocklists"
"descr": "doh_server"
},
"easylist": {
"url": "https://easylist-downloads.adblockplus.org/easylist.txt",
"rule": "BEGIN{FS=\"[|^]\"}/^\\|\\|([[:alnum:]_-]{1,63}\\.)+[[:alpha:]]+\\^(\\$third-party)?$/{print tolower($3)}",
"size": "M",
"focus": "compilation",
"descurl": "https://easylist.to"
"descr": "compilation"
},
"easyprivacy": {
"url": "https://easylist-downloads.adblockplus.org/easyprivacy.txt",
"rule": "BEGIN{FS=\"[|^]\"}/^\\|\\|([[:alnum:]_-]{1,63}\\.)+[[:alpha:]]+\\^(\\$third-party)?$/{print tolower($3)}",
"size": "M",
"focus": "tracking",
"descurl": "https://easylist.to"
"descr": "tracking"
},
"energized_blu": {
"url": "https://energized.pro/blu/domains.txt",
"rule": "/^([[:alnum:]_-]{1,63}\\.)+[[:alpha:]]+([[:space:]]|$)/{print tolower($1)}",
"size": "XL",
"focus": "compilation",
"descurl": "https://energized.pro"
"descr": "compilation"
},
"energized_spark": {
"url": "https://energized.pro/spark/domains.txt",
"rule": "/^([[:alnum:]_-]{1,63}\\.)+[[:alpha:]]+([[:space:]]|$)/{print tolower($1)}",
"size": "L",
"focus": "compilation",
"descurl": "https://energized.pro"
"descr": "compilation"
},
"energized_ultimate": {
"url": "https://energized.pro/ultimate/domains.txt",
"rule": "/^([[:alnum:]_-]{1,63}\\.)+[[:alpha:]]+([[:space:]]|$)/{print tolower($1)}",
"size": "XXL",
"focus": "compilation",
"descurl": "https://energized.pro"
"descr": "compilation"
},
"firetv_tracking": {
"url": "https://raw.githubusercontent.com/Perflyst/PiHoleBlocklist/master/AmazonFireTV.txt",
"rule": "/^([[:alnum:]_-]{1,63}\\.)+[[:alpha:]]+([[:space:]]|$)/{print tolower($1)}",
"size": "S",
"focus": "tracking",
"descurl": "https://github.com/Perflyst/PiHoleBlocklist"
"descr": "tracking"
},
"games_tracking": {
"url": "https://raw.githubusercontent.com/KodoPengin/GameIndustry-hosts-Template/master/Main-Template/hosts",
"rule": "/^0\\.0\\.0\\.0[[:space:]]+([[:alnum:]_-]{1,63}\\.)+[[:alpha:]]+([[:space:]]|$)/{print tolower($2)}",
"size": "S",
"focus": "tracking",
"descurl": "https://www.gameindustry.eu"
"descr": "tracking"
},
"hblock": {
"url": "https://hblock.molinero.dev/hosts_domains.txt",
"rule": "/^([[:alnum:]_-]{1,63}\\.)+[[:alpha:]]+([[:space:]]|$)/{print tolower($1)}",
"size": "XL",
"focus": "compilation",
"descurl": "https://hblock.molinero.dev"
"descr": "compilation"
},
"hagezi": {
"url": "https://raw.githubusercontent.com/hagezi/dns-blocklists/main/wildcard/",
"rule": "/^([[:alnum:]_-]{1,63}\\.)+[[:alpha:]]+([[:space:]]|$)/{print tolower($1)}",
"size": "VAR",
"focus": "compilation",
"descurl": "https://github.com/hagezi/dns-blocklists"
"descr": "compilation"
},
"lightswitch05": {
"url": "https://www.github.developerdan.com/hosts/lists/ads-and-tracking-extended.txt",
"rule": "/^0\\.0\\.0\\.0[[:space:]]+([[:alnum:]_-]{1,63}\\.)+[[:alpha:]]+([[:space:]]|$)/{print tolower($2)}",
"size": "XL",
"focus": "compilation",
"descurl": "https://github.com/lightswitch05/hosts"
"descr": "compilation"
},
"notracking": {
"url": "https://raw.githubusercontent.com/notracking/hosts-blocklists/master/dnscrypt-proxy/dnscrypt-proxy.blacklist.txt",
"rule": "/^([[:alnum:]_-]{1,63}\\.)+[[:alpha:]]+([[:space:]]|$)/{print tolower($1)}",
"size": "XL",
"focus": "tracking",
"descurl": "https://github.com/notracking/hosts-blocklists"
"descr": "tracking"
},
"oisd_big": {
"url": "https://big.oisd.nl/domainswild2",
"rule": "/^([[:alnum:]_-]{1,63}\\.)+[[:alpha:]]+([[:space:]]|$)/{print tolower($1)}",
"size": "XXL",
"focus": "general",
"descurl": "https://oisd.nl"
"descr": "general"
},
"oisd_nsfw": {
"url": "https://nsfw.oisd.nl/domainswild2",
"rule": "/^([[:alnum:]_-]{1,63}\\.)+[[:alpha:]]+([[:space:]]|$)/{print tolower($1)}",
"size": "XXL",
"focus": "porn",
"descurl": "https://oisd.nl"
"descr": "porn"
},
"oisd_nsfw_small": {
"url": "https://nsfw-small.oisd.nl/domainswild2",
"rule": "/^([[:alnum:]_-]{1,63}\\.)+[[:alpha:]]+([[:space:]]|$)/{print tolower($1)}",
"size": "M",
"focus": "porn",
"descurl": "https://oisd.nl"
"descr": "porn"
},
"oisd_small": {
"url": "https://small.oisd.nl/domainswild2",
"rule": "/^([[:alnum:]_-]{1,63}\\.)+[[:alpha:]]+([[:space:]]|$)/{print tolower($1)}",
"size": "L",
"focus": "general",
"descurl": "https://oisd.nl"
"descr": "general"
},
"openphish": {
"url": "https://openphish.com/feed.txt",
"rule": "BEGIN{FS=\"\/\"}/^http[s]?:\\/\\/([[:alnum:]_-]{1,63}\\.)+[[:alpha:]]+(\\/|$)/{print tolower($3)}",
"size": "S",
"focus": "phishing",
"descurl": "https://openphish.com"
"descr": "phishing"
},
"phishing_army": {
"url": "https://phishing.army/download/phishing_army_blocklist_extended.txt",
"rule": "/^([[:alnum:]_-]{1,63}\\.)+[[:alpha:]]+([[:space:]]|$)/{print tolower($1)}",
"size": "S",
"focus": "phishing",
"descurl": "https://phishing.army"
"descr": "phishing"
},
"reg_cn": {
"url": "https://easylist-downloads.adblockplus.org/easylistchina.txt",
"rule": "BEGIN{FS=\"[|^]\"}/^\\|\\|([[:alnum:]_-]{1,63}\\.)+[[:alpha:]]+\\^(\\$third-party)?$/{print tolower($3)}",
"size": "S",
"focus": "reg_china",
"descurl": "https://easylist.to"
"descr": "reg_china"
},
"reg_cz": {
"url": "https://easylist-downloads.adblockplus.org/easylistczechslovak.txt",
"rule": "BEGIN{FS=\"[|^]\"}/^\\|\\|([[:alnum:]_-]{1,63}\\.)+[[:alpha:]]+\\^(\\$third-party)?$/{print tolower($3)}",
"size": "S",
"focus": "reg_czech+slovak",
"descurl": "https://easylist.to"
"descr": "reg_czech+slovak"
},
"reg_de": {
"url": "https://easylist-downloads.adblockplus.org/easylistgermany.txt",
"rule": "BEGIN{FS=\"[|^]\"}/^\\|\\|([[:alnum:]_-]{1,63}\\.)+[[:alpha:]]+\\^(\\$third-party)?$/{print tolower($3)}",
"size": "S",
"focus": "reg_germany",
"descurl": "https://easylist.to"
"descr": "reg_germany"
},
"reg_es": {
"url": "https://easylist-downloads.adblockplus.org/easylistspanish.txt",
"rule": "BEGIN{FS=\"[|^]\"}/^\\|\\|([[:alnum:]_-]{1,63}\\.)+[[:alpha:]]+\\^(\\$third-party)?$/{print tolower($3)}",
"size": "S",
"focus": "reg_spain",
"descurl": "https://easylist.to"
"descr": "reg_spain"
},
"reg_fi": {
"url": "https://raw.githubusercontent.com/finnish-easylist-addition/finnish-easylist-addition/master/Finland_adb.txt",
"rule": "BEGIN{FS=\"[|^]\"}/^\\|\\|([[:alnum:]_-]{1,63}\\.)+[[:alpha:]]+\\^(\\$third-party)?$/{print tolower($3)}",
"size": "S",
"focus": "reg_finland",
"descurl": "https://github.com/finnish-easylist-addition"
"descr": "reg_finland"
},
"reg_fr": {
"url": "https://easylist-downloads.adblockplus.org/liste_fr.txt",
"rule": "BEGIN{FS=\"[|^]\"}/^\\|\\|([[:alnum:]_-]{1,63}\\.)+[[:alpha:]]+\\^(\\$third-party)?$/{print tolower($3)}",
"size": "M",
"focus": "reg_france",
"descurl": "https://forums.lanik.us/viewforum.php?f=91"
"descr": "reg_france"
},
"reg_id": {
"url": "https://easylist-downloads.adblockplus.org/abpindo.txt",
"rule": "BEGIN{FS=\"[|^]\"}/^\\|\\|([[:alnum:]_-]{1,63}\\.)+[[:alpha:]]+\\^(\\$third-party)?$/{print tolower($3)}",
"size": "S",
"focus": "reg_indonesia",
"descurl": "https://easylist.to"
"descr": "reg_indonesia"
},
"reg_it": {
"url": "https://easylist-downloads.adblockplus.org/easylistitaly.txt",
"rule": "BEGIN{FS=\"[|^]\"}/^\\|\\|([[:alnum:]_-]{1,63}\\.)+[[:alpha:]]+\\^(\\$third-party)?$/{print tolower($3)}",
"size": "S",
"focus": "reg_italy",
"descurl": "https://easylist.to"
"descr": "reg_italy"
},
"reg_jp": {
"url": "https://raw.githubusercontent.com/k2jp/abp-japanese-filters/master/abpjf.txt",
"rule": "BEGIN{FS=\"[|^]\"}/^\\|\\|([[:alnum:]_-]{1,63}\\.)+[[:alpha:]]+\\^(\\$third-party)?$/{print tolower($3)}",
"size": "S",
"focus": "reg_japan",
"descurl": "https://github.com/k2jp/abp-japanese-filters"
"descr": "reg_japan"
},
"reg_kr": {
"url": "https://raw.githubusercontent.com/List-KR/List-KR/master/filters-share/adservice.txt",
"rule": "BEGIN{FS=\"[|^]\"}/^\\|\\|([[:alnum:]_-]{1,63}\\.)+[[:alpha:]]+\\^(\\$third-party)?$/{print tolower($3)}",
"size": "S",
"focus": "reg_korea",
"descurl": "https://github.com/List-KR/List-KR"
"descr": "reg_korea"
},
"reg_lt": {
"url": "https://easylist-downloads.adblockplus.org/easylistlithuania.txt",
"rule": "BEGIN{FS=\"[|^]\"}/^\\|\\|([[:alnum:]_-]{1,63}\\.)+[[:alpha:]]+\\^(\\$third-party)?$/{print tolower($3)}",
"size": "S",
"focus": "reg_lithuania",
"descurl": "https://easylist.to"
"descr": "reg_lithuania"
},
"reg_nl": {
"url": "https://easylist-downloads.adblockplus.org/easylistdutch.txt",
"rule": "BEGIN{FS=\"[|^]\"}/^\\|\\|([[:alnum:]_-]{1,63}\\.)+[[:alpha:]]+\\^(\\$third-party)?$/{print tolower($3)}",
"size": "S",
"focus": "reg_netherlands",
"descurl": "https://easylist.to"
"descr": "reg_netherlands"
},
"reg_pl": {
"url": "https://raw.githubusercontent.com/PolishFiltersTeam/KADhosts/master/KADhosts.txt",
"rule": "/^0\\.0\\.0\\.0[[:space:]]+([[:alnum:]_-]{1,63}\\.)+[[:alpha:]]+([[:space:]]|$)/{print tolower($2)}",
"size": "M",
"focus": "reg_poland",
"descurl": "https://kadantiscam.netlify.app"
"descr": "reg_poland"
},
"reg_ro": {
"url": "https://easylist-downloads.adblockplus.org/rolist.txt",
"rule": "BEGIN{FS=\"[|^]\"}/^\\|\\|([[:alnum:]_-]{1,63}\\.)+[[:alpha:]]+\\^(\\$third-party)?$/{print tolower($3)}",
"size": "S",
"focus": "reg_romania",
"descurl": "https://easylist.to"
"descr": "reg_romania"
},
"reg_ru": {
"url": "https://easylist-downloads.adblockplus.org/ruadlist.txt",
"rule": "BEGIN{FS=\"[|^]\"}/^\\|\\|([[:alnum:]_-]{1,63}\\.)+[[:alpha:]]+\\^(\\$third-party)?$/{print tolower($3)}",
"size": "S",
"focus": "reg_russia",
"descurl": "https://easylist.to"
"descr": "reg_russia"
},
"reg_se": {
"url": "https://raw.githubusercontent.com/lassekongo83/Frellwits-filter-lists/master/Frellwits-Swedish-Hosts-File.txt",
"rule": "/^127\\.0\\.0\\.1[[:space:]]+([[:alnum:]_-]{1,63}\\.)+[[:alpha:]]+([[:space:]]|$)/{print tolower($2)}",
"size": "S",
"focus": "reg_sweden",
"descurl": "https://github.com/lassekongo83/Frellwits-filter-lists"
"descr": "reg_sweden"
},
"reg_vn": {
"url": "https://raw.githubusercontent.com/bigdargon/hostsVN/master/hosts",
"rule": "/^0\\.0\\.0\\.0[[:space:]]+([[:alnum:]_-]{1,63}\\.)+[[:alpha:]]+([[:space:]]|$)/{print tolower($2)}",
"size": "S",
"focus": "reg_vietnam",
"descurl": "https://bigdargon.github.io/hostsVN"
"descr": "reg_vietnam"
},
"smarttv_tracking": {
"url": "https://raw.githubusercontent.com/Perflyst/PiHoleBlocklist/master/SmartTV.txt",
"rule": "/^([[:alnum:]_-]{1,63}\\.)+[[:alpha:]]+([[:space:]]|$)/{print tolower($1)}",
"size": "S",
"focus": "tracking",
"descurl": "https://github.com/Perflyst/PiHoleBlocklist"
"descr": "tracking"
},
"spam404": {
"url": "https://raw.githubusercontent.com/Dawsey21/Lists/master/main-blacklist.txt",
"rule": "/^([[:alnum:]_-]{1,63}\\.)+[[:alpha:]]+([[:space:]]|$)/{print tolower($1)}",
"size": "S",
"focus": "general",
"descurl": "https://github.com/Dawsey21"
"descr": "general"
},
"stevenblack": {
"url": "https://raw.githubusercontent.com/StevenBlack/hosts/master/",
"rule": "/^0\\.0\\.0\\.0[[:space:]]+([[:alnum:]_-]{1,63}\\.)+[[:alpha:]]+([[:space:]]|$)/{print tolower($2)}",
"size": "VAR",
"focus": "compilation",
"descurl": "https://github.com/StevenBlack/hosts"
"descr": "compilation"
},
"stopforumspam": {
"url": "https://www.stopforumspam.com/downloads/toxic_domains_whole.txt",
"rule": "/^([[:alnum:]_-]{1,63}\\.)+[[:alpha:]]+([[:space:]]|$)/{print tolower($1)}",
"size": "S",
"focus": "spam",
"descurl": "https://www.stopforumspam.com"
"descr": "spam"
},
"utcapitole": {
"url": "https://dsi.ut-capitole.fr/blacklists/download/blacklists.tar.gz",
"rule": "/^([[:alnum:]_-]{1,63}\\.)+[[:alpha:]]+([[:space:]]|$)/{print tolower($1)}",
"size": "VAR",
"focus": "general",
"descurl": "https://dsi.ut-capitole.fr/blacklists/index_en.php"
"descr": "general"
},
"wally3k": {
"url": "https://v.firebog.net/hosts/static/w3kbl.txt",
"rule": "/^([[:alnum:]_-]{1,63}\\.)+[[:alpha:]]+([[:space:]]|$)/{print tolower($1)}",
"size": "S",
"focus": "compilation",
"descurl": "https://firebog.net/about"
"descr": "compilation"
},
"whocares": {
"url": "https://someonewhocares.org/hosts/hosts",
"rule": "/^127\\.0\\.0\\.1[[:space:]]+([[:alnum:]_-]{1,63}\\.)+[[:alpha:]]+([[:space:]]|$)/{print tolower($2)}",
"size": "M",
"focus": "general",
"descurl": "https://someonewhocares.org"
"descr": "general"
},
"winhelp": {
"url": "https://winhelp2002.mvps.org/hosts.txt",
"rule": "/^0\\.0\\.0\\.0[[:space:]]+([[:alnum:]_-]{1,63}\\.)+[[:alpha:]]+([[:space:]]|$)/{print tolower($2)}",
"size": "S",
"focus": "general",
"descurl": "https://winhelp2002.mvps.org"
"descr": "general"
},
"winspy": {
"url": "https://raw.githubusercontent.com/crazy-max/WindowsSpyBlocker/master/data/hosts/spy.txt",
"rule": "/^0\\.0\\.0\\.0[[:space:]]+([[:alnum:]_-]{1,63}\\.)+[[:alpha:]]+([[:space:]]|$)/{print tolower($2)}",
"size": "S",
"focus": "win_telemetry",
"descurl": "https://github.com/crazy-max/WindowsSpyBlocker"
"descr": "win_telemetry"
},
"yoyo": {
"url": "https://pgl.yoyo.org/adservers/serverlist.php?hostformat=nohtml&showintro=0&mimetype=plaintext",
"rule": "/^([[:alnum:]_-]{1,63}\\.)+[[:alpha:]]+([[:space:]]|$)/{print tolower($1)}",
"size": "S",
"focus": "general",
"descurl": "https://pgl.yoyo.org/as"
"descr": "general"
}
}

View File

@@ -1,5 +1,5 @@
#!/bin/sh /etc/rc.common
# Copyright (c) 2015-2024 Dirk Brenken (dev@brenken.org)
# Copyright (c) 2015-2025 Dirk Brenken (dev@brenken.org)
# This is free software, licensed under the GNU General Public License v3.
# (s)hellcheck exceptions
@@ -11,16 +11,14 @@ USE_PROCD=1
extra_command "suspend" "Suspend adblock processing"
extra_command "resume" "Resume adblock processing"
extra_command "query" "<domain> Query active blocklists and backups for a specific domain"
extra_command "report" "[[<cli>|<mail>|<gen>|<json>] [<top_count>] [<res_count>] [<search>]] Print DNS statistics with an optional search parameter"
extra_command "list" "List available sources"
extra_command "timer" "[<add> <tasks> <hour> [<minute>] [<weekday>]]|[<remove> <line no.>] List/Edit cron update intervals"
extra_command "report" "[<cli>|<mail>|<gen>|<json>] Print DNS statistics"
adb_init="/etc/init.d/adblock"
adb_script="/usr/bin/adblock.sh"
adb_pidfile="/var/run/adblock.pid"
[ "${action}" = "boot" ] && "${adb_init}" running && exit 0
[ -s "${adb_pidfile}" ] && { [ "${action}" = "start" ] || [ "${action}" = "stop" ] || [ "${action}" = "restart" ] || [ "${action}" = "reload" ] || [ "${action}" = "report" ] || [ "${action}" = "suspend" ] || [ "${action}" = "resume" ] || [ "${action}" = "query" ] || { [ "${action}" = "list" ] && [ -n "${1}" ]; }; } && exit 1
[ -s "${adb_pidfile}" ] && { [ "${action}" = "start" ] || [ "${action}" = "stop" ] || [ "${action}" = "restart" ] || [ "${action}" = "reload" ] || [ "${action}" = "report" ] || [ "${action}" = "suspend" ] || [ "${action}" = "resume" ] || [ "${action}" = "query" ]; } && exit 1
boot() {
: >"${adb_pidfile}"
@@ -42,6 +40,10 @@ start_service() {
fi
}
restart() {
rc_procd start_service restart
}
reload_service() {
rc_procd start_service reload
}
@@ -50,11 +52,6 @@ stop_service() {
rc_procd "${adb_script}" stop
}
restart() {
rc_procd "${adb_script}" stop
rc_procd start_service restart
}
suspend() {
rc_procd start_service suspend
}
@@ -71,80 +68,21 @@ report() {
rc_procd "${adb_script}" report "${1:-"cli"}" "${2}" "${3}" "${4}"
}
list() {
local src_archive src_file src_enabled enabled name utc_list size focus descurl
src_archive="$(uci_get adblock global adb_srcarc "/etc/adblock/adblock.sources.gz")"
src_file="$(uci_get adblock global adb_srcfile "/tmp/adb_sources.json")"
src_enabled="$(uci -q show adblock.global.adb_sources)"
[ -r "${src_archive}" ] && zcat "${src_archive}" >"${src_file}" || printf "%s\n" "::: adblock source archive '${src_archive}' not found"
if [ -r "${src_file}" ]; then
src_enabled="${src_enabled#*=}"
src_enabled="${src_enabled//\'}"
printf "%s\n" "::: Available adblock sources"
printf "%s\n" ":::"
printf "%-25s%-10s%-7s%-21s%s\n" " Name" "Enabled" "Size" "Focus" "Info URL"
printf "%s\n" " -------------------------------------------------------------------"
json_load_file "${src_file}"
json_get_keys keylist
for key in ${keylist}; do
json_select "${key}"
json_get_var size "size"
json_get_var focus "focus"
json_get_var descurl "descurl"
json_get_var url "url"
json_get_var rule "rule"
if [ -n "${url}" ] && [ -n "${rule}" ]; then
if printf "%s" "${src_enabled}" | grep -q "${key}"; then
enabled="x"
else
enabled=" "
fi
src_enabled="${src_enabled/${key}}"
printf " + %-21s%-10s%-7s%-21s%s\n" "${key:0:20}" "${enabled}" "${size:0:3}" "${focus:0:20}" "${descurl:0:50}"
else
src_enabled="${src_enabled} ${key}"
fi
json_select ..
done
utc_list="$(uci_get adblock global adb_utc_sources "-")"
hag_list="$(uci_get adblock global adb_hag_sources "-")"
stb_list="$(uci_get adblock global adb_stb_sources "-")"
printf "%s\n" " ---------------------------------------------------------------------------"
printf " * %s\n" "Configured utcapitole categories: ${utc_list// /, }"
printf " * %s\n" "Configured hagezi variants: ${hag_list// /, }"
printf " * %s\n" "Configured stevenblack variants: ${stb_list// /, }"
if [ -n "${src_enabled// }" ]; then
printf "%s\n" " ---------------------------------------------------------------------------"
printf "%s\n" " Sources with invalid configuration"
printf "%s\n" " ---------------------------------------------------------------------------"
for key in ${src_enabled}; do
printf " - %s\n" "${key:0:20}"
done
fi
else
printf "%s\n" "::: adblock source file '${src_file}' not found"
fi
}
status() {
status_service
}
status_service() {
local key keylist value values rtfile
local key keylist value values
rtfile="$(uci_get adblock global adb_rtfile "/tmp/adb_runtime.json")"
json_init
json_load_file "${rtfile}" >/dev/null 2>&1
json_load_file "/var/run/adb_runtime.json" >/dev/null 2>&1
json_get_keys keylist
if [ -n "${keylist}" ]; then
printf "%s\n" "::: adblock runtime information"
for key in ${keylist}; do
json_get_var value "${key}" >/dev/null 2>&1
if [ "${key}" = "active_sources" ]; then
if [ "${key}" = "active_feeds" ]; then
json_get_values values "${key}" >/dev/null 2>&1
value="${values// /, }"
fi
@@ -155,33 +93,6 @@ status_service() {
fi
}
timer() {
local cron_file cron_content cron_lineno action="${1:-"list"}" cron_tasks="${2}" hour="${3}" minute="${4:-0}" weekday="${5:-"*"}"
cron_file="/etc/crontabs/root"
if [ -s "${cron_file}" ] && [ "${action}" = "list" ]; then
awk '{print NR "> " $0}' "${cron_file}"
elif [ -x "/etc/init.d/cron" ] && [ "${action}" = "add" ]; then
hour="${hour//[[:alpha:]]/}"
minute="${minute//[[:alpha:]]/}"
if [ -n "${cron_tasks}" ] && [ -n "${hour}" ] && [ -n "${minute}" ] && [ -n "${weekday}" ] &&
[ "${hour}" -ge 0 ] && [ "${hour}" -le 23 ] &&
[ "${minute}" -ge 0 ] && [ "${minute}" -le 59 ]; then
printf "%02d %02d %s\n" "${minute}" "${hour}" "* * ${weekday} ${adb_init} ${cron_tasks}" >>"${cron_file}"
/etc/init.d/cron restart
fi
elif [ -x "/etc/init.d/cron" ] && [ -s "${cron_file}" ] && [ "${action}" = "remove" ]; then
cron_tasks="${cron_tasks//[[:alpha:]]/}"
cron_lineno="$(awk 'END{print NR}' "${cron_file}")"
cron_content="$(awk '{print $0}' "${cron_file}")"
if [ "${cron_tasks:-"0"}" -le "${cron_lineno:-"1"}" ] && [ -n "${cron_content}" ]; then
printf "%s\n" "${cron_content}" | awk "NR!~/^${cron_tasks}$/" >"${cron_file}"
/etc/init.d/cron restart
fi
fi
}
service_triggers() {
local iface delay
@@ -190,7 +101,4 @@ service_triggers() {
PROCD_RELOAD_DELAY="$((delay * 1000))"
[ -n "${iface}" ] && procd_add_interface_trigger "interface.*.up" "${iface}" "${adb_init}" start
PROCD_RELOAD_DELAY="$((2 * 1000))"
procd_add_reload_trigger "adblock"
}

File diff suppressed because it is too large Load Diff