adblock: small update
authorDirk Brenken <dev@brenken.org>
Wed, 10 Mar 2021 10:38:15 +0000 (11:38 +0100)
committerDirk Brenken <dev@brenken.org>
Wed, 10 Mar 2021 13:44:40 +0000 (14:44 +0100)
* add adguard_tracking source (list with cname trackers)
* optimize/sort output of active sources in status
* optimize log output in EMails

Signed-off-by: Dirk Brenken <dev@brenken.org>
(cherry picked from commit f91e5cc666ac205a86385b331140921e3dc906fd)

net/adblock/Makefile
net/adblock/files/README.md
net/adblock/files/adblock.mail
net/adblock/files/adblock.sh
net/adblock/files/adblock.sources

index 94a4df594d4dfe088c2ace05d2d9ac003e107b7e..6481a79f32b70ad3da0489156d9e985a69ad05a4 100644 (file)
@@ -7,7 +7,7 @@ include $(TOPDIR)/rules.mk
 
 PKG_NAME:=adblock
 PKG_VERSION:=4.1.0
-PKG_RELEASE:=1
+PKG_RELEASE:=2
 PKG_LICENSE:=GPL-3.0-or-later
 PKG_MAINTAINER:=Dirk Brenken <dev@brenken.org>
 
index 2e4e4cafa7e8c1eb0a90daa604e3f616dfe395a7..f0f145c3fb133bd777250fe0eef588b04a4af6c2 100644 (file)
@@ -12,9 +12,10 @@ A lot of people already use adblocker plugins within their desktop browsers, but
 | :------------------ | :-----: | :--- | :--------------- | :-------------------------------------------------------------------------------- |
 | adaway              | x       | S    | mobile           | [Link](https://github.com/AdAway/adaway.github.io)                                |
 | adguard             | x       | L    | general          | [Link](https://adguard.com)                                                       |
-| anti_ad             |         | L    | compilation      | [Link](https://github.com/privacy-protection-tools/anti-AD/blob/master/README.md) |
+| adguard_tracking    |         | S    | tracking         | [Link](https://github.com/AdguardTeam/cname-trackers)                             |
 | android_tracking    |         | S    | tracking         | [Link](https://github.com/Perflyst/PiHoleBlocklist)                               |
 | andryou             |         | L    | compilation      | [Link](https://gitlab.com/andryou/block/-/blob/master/readme.md)                  |
+| anti_ad             |         | L    | compilation      | [Link](https://github.com/privacy-protection-tools/anti-AD/blob/master/README.md) |
 | anudeep             |         | M    | compilation      | [Link](https://github.com/anudeepND/blacklist)                                    |
 | bitcoin             |         | S    | mining           | [Link](https://github.com/hoshsadiq/adblock-nocoin-list)                          |
 | disconnect          | x       | S    | general          | [Link](https://disconnect.me)                                                     |
@@ -61,6 +62,7 @@ A lot of people already use adblocker plugins within their desktop browsers, but
     • <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-500k) 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 five different DNS backend formats: dnsmasq, unbound, named (bind), kresd or raw (e.g. used by dnscrypt-proxy)
index 0683ede31171acdc35b125b91582a7c7b2015e2b..be5d260722ba6d521400658fdd72750cc2d2c2df 100755 (executable)
@@ -1,6 +1,6 @@
 #!/bin/sh
 # send mail script for adblock notifications
-# Copyright (c) 2015-2020 Dirk Brenken (dev@brenken.org)
+# Copyright (c) 2015-2021 Dirk Brenken (dev@brenken.org)
 # This is free software, licensed under the GNU General Public License v3.
 
 # Please note: you have to manually install and configure the package 'msmtp' before using this script
@@ -55,12 +55,9 @@ adb_mailhead="From: ${adb_mailsender}\\nTo: ${adb_mailreceiver}\\nSubject: ${adb
 #
 sys_info="$(strings /etc/banner 2>/dev/null; ubus call system board | sed -e 's/\"release\": {//' | sed -e 's/^[ \t]*//' | sed -e 's/[{}\",]//g' | sed -e 's/[ ]/  \t/' | sed '/^$/d' 2>/dev/null)"
 adb_info="$(/etc/init.d/adblock status 2>/dev/null)"
-if [ -f "/var/log/messages" ]
+if [ -x "${adb_logread}" ]
 then
-       log_info="$(awk '/adblock-/{NR=1;max=79;if(length($0)>max+1)while($0){if(NR==1){print substr($0,1,max),"&#8629;"} else {print " ",substr($0,1,max)}{$0=substr($0,max+1);NR=NR+1}}else print}' /var/log/messages)"
-elif [ -x "${adb_logread}" ]
-then
-       log_info="$("${adb_logread}" -e "adblock-" | awk '{NR=1;max=79;if(length($0)>max+1)while($0){if(NR==1){print substr($0,1,max),"&#8629;"} else {print " ",substr($0,1,max)}{$0=substr($0,max+1);NR=NR+1}}else print}')"
+       log_info="$("${adb_logread}" -l 100 -e "adblock-" | awk '{NR=1;max=120;if(length($0)>max+1)while($0){if(NR==1){print substr($0,1,max)}else{print substr($0,1,max)}{$0=substr($0,max+1);NR=NR+1}}else print}')"
 fi
 
 # mail body
index d987e0aa6e6c43cc1a6bdb61eecf1294abad1105..0177a793b738a24bd49f9ebe74a0898260377816 100755 (executable)
@@ -1082,7 +1082,7 @@ f_query()
 #
 f_jsnup()
 {
-       local runtime utils memory bg_pid status="${1:-"enabled"}"
+       local entry sources runtime utils memory bg_pid status="${1:-"enabled"}"
 
        case "${status}" in
                "enabled"|"error")
@@ -1125,6 +1125,8 @@ f_jsnup()
                        json_get_var runtime "last_run"
                fi
        fi
+       sources="$(printf "%s\n" ${adb_sources} | "${adb_sort}" | "${adb_awk}" '{ORS=" ";print $0}')"
+
        > "${adb_rtfile}"
        json_load_file "${adb_rtfile}" >/dev/null 2>&1
        json_init
@@ -1132,7 +1134,7 @@ f_jsnup()
        json_add_string "adblock_version" "${adb_ver}"
        json_add_string "blocked_domains" "${adb_cnt:-0}"
        json_add_array "active_sources"
-       for entry in ${adb_sources}
+       for entry in ${sources}
        do
                json_add_object
                json_add_string "source" "${entry}"
index 7cc7a8561865fd5989576b834110f8a950d54342..1b83ea64568204e15c403d5ab8debed799f93527 100644 (file)
                "focus": "general",
                "descurl": "https://adguard.com"
        },
+       "adguard_tracking": {
+               "url": "https://raw.githubusercontent.com/AdguardTeam/cname-trackers/master/combined_disguised_trackers_justdomains.txt",
+               "rule": "/^([[:alnum:]_-]{1,63}\\.)+[[:alpha:]]+([[:space:]]|$)/{print tolower($1)}",
+               "size": "S",
+               "focus": "tracking",
+               "descurl": "https://github.com/AdguardTeam/cname-trackers"
+       },
        "android_tracking": {
                "url": "https://raw.githubusercontent.com/Perflyst/PiHoleBlocklist/master/android-tracking.txt",
                "rule": "/^([[:alnum:]_-]{1,63}\\.)+[[:alpha:]]+([[:space:]]|$)/{print tolower($1)}",