From f91e5cc666ac205a86385b331140921e3dc906fd Mon Sep 17 00:00:00 2001 From: Dirk Brenken Date: Wed, 10 Mar 2021 11:38:15 +0100 Subject: [PATCH] adblock: small update * 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 --- net/adblock/Makefile | 2 +- net/adblock/files/README.md | 4 +++- net/adblock/files/adblock.mail | 9 +++------ net/adblock/files/adblock.sh | 6 ++++-- net/adblock/files/adblock.sources | 7 +++++++ 5 files changed, 18 insertions(+), 10 deletions(-) diff --git a/net/adblock/Makefile b/net/adblock/Makefile index 94a4df594..6481a79f3 100644 --- a/net/adblock/Makefile +++ b/net/adblock/Makefile @@ -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 diff --git a/net/adblock/files/README.md b/net/adblock/files/README.md index 2e4e4cafa..f0f145c3f 100644 --- a/net/adblock/files/README.md +++ b/net/adblock/files/README.md @@ -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 • S (-10k), M (10k-30k) and L (30k-80k) should work for 128 MByte devices, • XL (80k-200k) should work for 256-512 MByte devices, • XXL (200k-) needs more RAM and Multicore support, e.g. x86 or raspberry devices. + • VAR (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) diff --git a/net/adblock/files/adblock.mail b/net/adblock/files/adblock.mail index 0683ede31..be5d26072 100755 --- a/net/adblock/files/adblock.mail +++ b/net/adblock/files/adblock.mail @@ -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),"↵"} 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),"↵"} 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 diff --git a/net/adblock/files/adblock.sh b/net/adblock/files/adblock.sh index d987e0aa6..0177a793b 100755 --- a/net/adblock/files/adblock.sh +++ b/net/adblock/files/adblock.sh @@ -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}" diff --git a/net/adblock/files/adblock.sources b/net/adblock/files/adblock.sources index 7cc7a8561..1b83ea645 100644 --- a/net/adblock/files/adblock.sources +++ b/net/adblock/files/adblock.sources @@ -13,6 +13,13 @@ "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)}",