Browse Source

adblock: update 4.0.7

* 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>
lilik-openwrt-22.03
Dirk Brenken 4 years ago
parent
commit
d36fd57662
No known key found for this signature in database GPG Key ID: 9D71CD547BFAE684
8 changed files with 61 additions and 12 deletions
  1. +2
    -2
      net/adblock/Makefile
  2. +3
    -0
      net/adblock/files/README.md
  3. +11
    -2
      net/adblock/files/adblock.init
  4. +3
    -0
      net/adblock/files/adblock.mail
  5. +3
    -0
      net/adblock/files/adblock.monitor
  6. +29
    -8
      net/adblock/files/adblock.sh
  7. +7
    -0
      net/adblock/files/adblock.sources
  8. +3
    -0
      net/adblock/test.sh

+ 2
- 2
net/adblock/Makefile View 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>


+ 3
- 0
net/adblock/files/README.md View 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) |


+ 11
- 2
net/adblock/files/adblock.init View File

@ -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}"


+ 3
- 0
net/adblock/files/adblock.mail View File

@ -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"


+ 3
- 0
net/adblock/files/adblock.monitor View File

@ -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"


+ 29
- 8
net/adblock/files/adblock.sh View File

@ -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


+ 7
- 0
net/adblock/files/adblock.sources View File

@ -195,6 +195,13 @@
"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)}",


+ 3
- 0
net/adblock/test.sh View File

@ -0,0 +1,3 @@
#!/bin/sh
/etc/init.d/"${1}" version 2>/dev/null | grep "${2}"

Loading…
Cancel
Save