adblock: update 4.0.7 13705/head
authorDirk Brenken <dev@brenken.org>
Sun, 18 Oct 2020 09:05:22 +0000 (11:05 +0200)
committerDirk Brenken <dev@brenken.org>
Sun, 18 Oct 2020 15:06:32 +0000 (17:06 +0200)
* fix aria2c download options
* fix report engine with empty domains
* fix safesearch ips of safe.duckduckgo.com (get ips dynamically)
* fix safesearch ips of safesearch.pixabay.com (get ips dynamically)
* add regional blocklist for italy
* shellcheck adjustments
* add test.sh for CI testing

Signed-off-by: Dirk Brenken <dev@brenken.org>
net/adblock/Makefile
net/adblock/files/README.md
net/adblock/files/adblock.init
net/adblock/files/adblock.mail
net/adblock/files/adblock.monitor
net/adblock/files/adblock.sh
net/adblock/files/adblock.sources
net/adblock/test.sh [new file with mode: 0755]

index 8d2ab9a7595ae4dbc071d70211111f35df4ffae2..da1d30cfe4f996bcf5c3cc70a59aba7fa3df4d52 100644 (file)
@@ -6,8 +6,8 @@
 include $(TOPDIR)/rules.mk
 
 PKG_NAME:=adblock
-PKG_VERSION:=4.0.6
-PKG_RELEASE:=3
+PKG_VERSION:=4.0.7
+PKG_RELEASE:=1
 PKG_LICENSE:=GPL-3.0-or-later
 PKG_MAINTAINER:=Dirk Brenken <dev@brenken.org>
 
index 29a1ff8e704296fecd1a989af70699e0f4569847..6b9f292749d86e07b17edebd295b2c486054bd96 100644 (file)
@@ -1,3 +1,5 @@
+<!-- markdownlint-disable -->
+
 # DNS based ad/abuse domain blocking
 
 ## Description
@@ -36,6 +38,7 @@ A lot of people already use adblocker plugins within their desktop browsers, but
 | reg_fi              |         | S    | reg_finland      | [Link](https://github.com/finnish-easylist-addition)                              |
 | reg_fr              |         | S    | reg_france       | [Link](https://forums.lanik.us/viewforum.php?f=91)                                |
 | reg_id              |         | M    | reg_indonesia    | [Link](https://easylist.to)                                                       |
+| reg_it              |         | M    | reg_italy        | [Link](https://easylist.to)                                                       |
 | reg_kr              |         | S    | reg_korea        | [Link](https://list-kr.github.io)                                                 |
 | reg_nl              |         | M    | reg_netherlands  | [Link](https://easylist.to)                                                       |
 | reg_pl1             |         | S    | reg_poland       | [Link](https://kadantiscam.netlify.com)                                           |
index 780e3b6bd3a3de3b92bc3376325b02f2b31eab39..64dbd76845cc67726e3dee2ff1e41b446abbbfd5 100755 (executable)
@@ -2,16 +2,20 @@
 # Copyright (c) 2015-2020 Dirk Brenken (dev@brenken.org)
 # This is free software, licensed under the GNU General Public License v3.
 
+# set (s)hellcheck exceptions
+# shellcheck disable=1091,2010,2016,2034,2039,2059,2086,2091,2129,2143,2154,2181,2183,2188
+
 START=30
 USE_PROCD=1
 
-EXTRA_COMMANDS="suspend resume query report list timer status_service"
+EXTRA_COMMANDS="suspend resume query report list timer status_service version"
 EXTRA_HELP="   suspend Suspend adblock processing
        resume  Resume adblock processing
        query   <domain> Query active blocklists and backups for a specific domain
        report  [<search>] Print DNS statistics with an optional search parameter
        list    [[<add>|<remove>] [source(s)]] List available adblock sources or add/remove them from config
-       timer   <action> <hour> [<minute>] [<weekday>] Set a cron based update interval"
+       timer   <action> <hour> [<minute>] [<weekday>] Set a cron based update interval
+       version print version information"
 
 adb_init="/etc/init.d/adblock"
 adb_script="/usr/bin/adblock.sh"
@@ -25,6 +29,11 @@ then
        exit 0
 fi
 
+version()
+{
+       rc_procd "${adb_script}" version
+}
+
 boot()
 {
        [ -s "${adb_pidfile}" ] && > "${adb_pidfile}"
index ca9d206d14712cd7b1cc70b4578e43fbf558b4e5..0683ede31171acdc35b125b91582a7c7b2015e2b 100755 (executable)
@@ -5,6 +5,9 @@
 
 # Please note: you have to manually install and configure the package 'msmtp' before using this script
 
+# set (s)hellcheck exceptions
+# shellcheck disable=1091,2010,2016,2034,2039,2059,2086,2091,2129,2143,2154,2181,2183,2188
+
 LC_ALL=C
 PATH="/usr/sbin:/usr/bin:/sbin:/bin"
 
index 7fe90c8c91ac0d853e7b818e16b1352bcbe5a061..b5b73673db0ac9c106cc6b62d8881e8cba719360 100755 (executable)
@@ -3,6 +3,9 @@
 # Copyright (c) 2015-2020 Dirk Brenken (dev@brenken.org)
 # This is free software, licensed under the GNU General Public License v3.
 
+# set (s)hellcheck exceptions
+# shellcheck disable=1091,2010,2016,2034,2039,2059,2086,2091,2129,2143,2154,2181,2183,2188
+
 LC_ALL=C
 PATH="/usr/sbin:/usr/bin:/sbin:/bin"
 
index d545a67068a6e6513c12bcc44853843547d2ee71..fcbb64f93b313be17fa6ba3b5dfc0a22bdf53d67 100755 (executable)
@@ -4,14 +4,14 @@
 # This is free software, licensed under the GNU General Public License v3.
 
 # set (s)hellcheck exceptions
-# shellcheck disable=1091,2016,2039,2059,2086,2143,2181,2188
+# shellcheck disable=1091,2010,2016,2034,2039,2059,2086,2091,2129,2143,2154,2181,2183,2188
 
 # set initial defaults
 #
 export LC_ALL=C
 export PATH="/usr/sbin:/usr/bin:/sbin:/bin"
 set -o pipefail
-adb_ver="4.0.6"
+adb_ver="4.0.7"
 adb_enabled=0
 adb_debug=0
 adb_forcedns=0
@@ -386,7 +386,7 @@ f_fetch()
        fi
        case "${adb_fetchutil}" in
                "aria2c")
-                       adb_fetchparm="${adb_fetchparm:-"--timeout=20 --allow-overwrite=true --auto-file-renaming=false --check-certificate=true --dir= -o"}"
+                       adb_fetchparm="${adb_fetchparm:-"--timeout=20 --allow-overwrite=true --auto-file-renaming=false --check-certificate=true --log-level=warn --dir=/ -o"}"
                ;;
                "curl")
                        adb_fetchparm="${adb_fetchparm:-"--connect-timeout 20 --silent --show-error --location -o"}"
@@ -753,17 +753,30 @@ f_list()
                                        out_rc="${?}"
                                ;;
                                "duckduckgo")
-                                       safe_ips="50.16.250.179 54.208.102.2 52.204.96.252"
                                        safe_cname="safe.duckduckgo.com"
                                        safe_domains="duckduckgo.com"
-                                       printf "%s\n" ${safe_domains} > "${adb_tmpdir}/tmp.raw.safesearch.${src_name}"
+                                       if [ -x "${adb_lookupcmd}" ]
+                                       then
+                                               safe_ips="$("${adb_lookupcmd}" "${safe_cname}" 2>/dev/null | "${adb_awk}" '/Address [0-9]+:/{ORS=" ";print $3}')"
+                                               if [ -n "${safe_ips}" ]
+                                               then
+                                                       printf "%s\n" ${safe_domains} > "${adb_tmpdir}/tmp.raw.safesearch.${src_name}"
+                                               fi
+                                       fi
                                        out_rc="${?}"
                                ;;
                                "pixabay")
-                                       safe_ips="104.18.82.97 2606:4700::6812:8d57 2606:4700::6812:5261"
                                        safe_cname="safesearch.pixabay.com"
                                        safe_domains="pixabay.com"
                                        printf "%s\n" ${safe_domains} > "${adb_tmpdir}/tmp.raw.safesearch.${src_name}"
+                                       if [ -x "${adb_lookupcmd}" ]
+                                       then
+                                               safe_ips="$("${adb_lookupcmd}" "${safe_cname}" 2>/dev/null | "${adb_awk}" '/Address [0-9]+:/{ORS=" ";print $3}')"
+                                               if [ -n "${safe_ips}" ]
+                                               then
+                                                       printf "%s\n" ${safe_domains} > "${adb_tmpdir}/tmp.raw.safesearch.${src_name}"
+                                               fi
+                                       fi
                                        out_rc="${?}"
                                ;;
                                "yandex")
@@ -787,7 +800,7 @@ f_list()
                                        out_rc="${?}"
                                ;;
                        esac
-                       if [ "${out_rc}" -eq 0 ]
+                       if [ "${out_rc}" -eq 0 ] && [ -f "${adb_tmpdir}/tmp.raw.safesearch.${src_name}" ]
                        then
                                > "${adb_tmpdir}/tmp.safesearch.${src_name}"
                                if [ "${adb_dns}" = "named" ]
@@ -1469,7 +1482,7 @@ f_report()
                                (
                                        "${adb_dumpcmd}" -tttt -r "${file}" 2>/dev/null | \
                                                "${adb_awk}" -v cnt="${cnt}" '!/\.lan\. |PTR\? | SOA\? /&&/ A[\? ]+|NXDomain|0\.0\.0\.0/{a=$1;b=substr($2,0,8);c=$4;sub(/\.[0-9]+$/,"",c);d=cnt $7;sub(/\*$/,"",d);
-                                               e=$(NF-1);sub(/[0-9]\/[0-9]\/[0-9]|0\.0\.0\.0/,"NX",e);sub(/\.$/,"",e);sub(/([0-9]{1,3}\.){3}[0-9]{1,3}/,"OK",e);printf "%s\t%s\t%s\t%s\t%s\n",d,e,a,b,c}' >> "${adb_reportdir}/adb_report.raw"
+                                               e=$(NF-1);sub(/[0-9]\/[0-9]\/[0-9]|0\.0\.0\.0/,"NX",e);sub(/\.$/,"",e);sub(/([0-9]{1,3}\.){3}[0-9]{1,3}/,"OK",e);if(e==""){e="err"};printf "%s\t%s\t%s\t%s\t%s\n",d,e,a,b,c}' >> "${adb_reportdir}/adb_report.raw"
                                )&
                                hold=$((cnt%adb_maxqueue))
                                if [ "${hold}" -eq 0 ]
@@ -1615,6 +1628,14 @@ else
        f_log "err" "system libraries not found"
 fi
 
+# version information
+#
+if [ "${adb_action}" = "version" ]
+then
+       printf "%s\n" "${adb_ver}"
+       exit 0
+fi
+
 # handle different adblock actions
 #
 f_load
index e198092df0250e1f2183bc4791c54ab3f99f15a3..dfb9f1bae69ac456616b0dc3bafd212d4863a566 100644 (file)
                "focus": "reg_indonesia",
                "descurl": "https://easylist.to"
        },
+       "reg_it": {
+               "url": "https://easylist-downloads.adblockplus.org/easylistitaly+easylist.txt",
+               "rule": "BEGIN{FS=\"[|^]\"}/^\\|\\|([[:alnum:]_-]{1,63}\\.)+[[:alpha:]]+\\^(\\$third-party)?$/{print tolower($3)}",
+               "size": "M",
+               "focus": "reg_italy",
+               "descurl": "https://easylist.to"
+       },
        "reg_kr": {
                "url": "https://raw.githubusercontent.com/List-KR/List-KR/master/filter.txt",
                "rule": "BEGIN{FS=\"[|^]\"}/^\\|\\|([[:alnum:]_-]{1,63}\\.)+[[:alpha:]]+\\^(\\$third-party)?$/{print tolower($3)}",
diff --git a/net/adblock/test.sh b/net/adblock/test.sh
new file mode 100755 (executable)
index 0000000..607de97
--- /dev/null
@@ -0,0 +1,3 @@
+#!/bin/sh
+
+/etc/init.d/"${1}" version 2>/dev/null | grep "${2}"