Browse Source

adblock: bugfix 3.8.13

* remove 'ransomware' blocklist by abbuse.ch (discontinued)
  from default adblock config
* fix/switch 'someonewhocares' config to https only
* fix curl download parameters to follow redirects and
  suppress needless output
* made the tmp directory of sort operations configurable,
  set 'adb_sorttmp' accordingly (only supported by 'coreutils-sort')

Signed-off-by: Dirk Brenken <dev@brenken.org>
lilik-openwrt-22.03
Dirk Brenken 5 years ago
parent
commit
21a85fef22
No known key found for this signature in database GPG Key ID: 9D71CD547BFAE684
4 changed files with 21 additions and 21 deletions
  1. +1
    -1
      net/adblock/Makefile
  2. +1
    -3
      net/adblock/files/README.md
  3. +1
    -7
      net/adblock/files/adblock.conf
  4. +18
    -10
      net/adblock/files/adblock.sh

+ 1
- 1
net/adblock/Makefile View File

@ -6,7 +6,7 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=adblock
PKG_VERSION:=3.8.12
PKG_VERSION:=3.8.13
PKG_RELEASE:=1
PKG_LICENSE:=GPL-3.0-or-later
PKG_MAINTAINER:=Dirk Brenken <dev@brenken.org>


+ 1
- 3
net/adblock/files/README.md View File

@ -25,8 +25,6 @@ A lot of people already use adblocker plugins within their desktop browsers, but
* Daily updates, approx. 1.500 entries
* [openphish](https://openphish.com)
* Numerous updates on the same day, approx. 1.800 entries
* [ransomware tracker](https://ransomwaretracker.abuse.ch)
* Daily updates, approx. 150 entries
* [reg_cn](https://easylist-downloads.adblockplus.org/easylistchina+easylist.txt)
* Regional blocklist for China, daily updates, approx. 1.600 entries
* [reg_cz](https://raw.githubusercontent.com/qxstyles/turris-hole-czech-block-list/master/turris-hole-czech-block-list)
@ -51,7 +49,7 @@ A lot of people already use adblocker plugins within their desktop browsers, but
* Weekly updates, approx. 21.000 entries
* [ut_capitole](https://dsi.ut-capitole.fr/blacklists) (categories "cryptojacking" "ddos" "malware" "phishing" "warez" enabled by default)
* Daily updates, approx. 64.000 entries (a short description of all categories can be found [online](https://dsi.ut-capitole.fr/blacklists/index_en.php))
* [whocares](http://someonewhocares.org)
* [whocares](https://someonewhocares.org)
* Weekly updates, approx. 12.000 entries
* [winhelp](http://winhelp2002.mvps.org)
* Infrequent updates, approx. 15.000 entries


+ 1
- 7
net/adblock/files/adblock.conf View File

@ -67,12 +67,6 @@ config source 'openphish'
option adb_src_desc 'focus on phishing, numerous updates on the same day, approx. 2.400 entries'
option enabled '0'
config source 'ransomware'
option adb_src 'https://ransomwaretracker.abuse.ch/downloads/RW_DOMBL.txt'
option adb_src_rset '/^([[:alnum:]_-]+\.)+[[:alpha:]]+([[:space:]]|$)/{print tolower(\$1)}'
option adb_src_desc 'focus on ransomware by abuse.ch, numerous updates on the same day, approx. 1900 entries'
option enabled '0'
config source 'reg_cn'
option adb_src 'https://easylist-downloads.adblockplus.org/easylistchina+easylist.txt'
option adb_src_rset 'BEGIN{FS=\"[|^]\"}/^\|\|([[:alnum:]_-]+\.)+[[:alpha:]]+\^("\\\$third-party")?$/{print tolower(\$3)}'
@ -157,7 +151,7 @@ config source 'ut_capitole'
option enabled '0'
config source 'whocares'
option adb_src 'http://someonewhocares.org/hosts/hosts'
option adb_src 'https://someonewhocares.org/hosts/hosts'
option adb_src_rset '/^127\.0\.0\.1[[:space:]]+([[:alnum:]_-]+\.)+[[:alpha:]]+([[:space:]]|$)/{print tolower(\$2)}'
option adb_src_desc 'broad blocklist, weekly updates, approx. 10.000 entries'
option enabled '0'


+ 18
- 10
net/adblock/files/adblock.sh View File

@ -13,7 +13,7 @@
#
LC_ALL=C
PATH="/usr/sbin:/usr/bin:/sbin:/bin"
adb_ver="3.8.12"
adb_ver="3.8.13"
adb_basever=""
adb_enabled=0
adb_debug=0
@ -35,6 +35,7 @@ adb_dnsflush=0
adb_blacklist="/etc/adblock/adblock.blacklist"
adb_whitelist="/etc/adblock/adblock.whitelist"
adb_rtfile="/tmp/adb_runtime.json"
adb_sorttmpdir="/tmp"
adb_portlist="53 853 5353"
adb_report=0
adb_repiface="br-lan"
@ -235,6 +236,13 @@ f_env()
f_log "err" "backup directory '${adb_backupdir}' does not exist/is not mounted yet, please create the directory or raise the 'adb_triggerdelay' to defer the adblock start"
fi
# check sort temp directory
#
if [ ! -d "${adb_sorttmpdir}" ]
then
f_log "err" "sort temp directory '${adb_sorttmpdir}' does not exist/is not mounted yet, please create the directory or raise the 'adb_triggerdelay' to defer the adblock start"
fi
# check fetch utility
#
case "${adb_fetchutil}" in
@ -258,7 +266,7 @@ f_env()
adb_fetchparm="${adb_fetchparm:-"-O"}"
;;
"curl")
adb_fetchparm="${adb_fetchparm:-"--connect-timeout 10 --insecure -o"}"
adb_fetchparm="${adb_fetchparm:-"--connect-timeout 10 --silent --show-error --location --insecure -o"}"
ssl_lib="built-in"
;;
"aria2c")
@ -692,7 +700,7 @@ f_tld()
awk 'BEGIN{FS="."}{for(f=NF;f>1;f--)printf "%s.",$f;print $1}' "${source}" > "${temp_tld}"
if [ "${?}" -eq 0 ]
then
sort -u "${temp_tld}" > "${source}"
sort -T "${adb_sorttmpdir}" -u "${temp_tld}" > "${source}"
if [ "${?}" -eq 0 ]
then
cnt_srt="$(wc -l 2>/dev/null < "${source}")"
@ -710,7 +718,7 @@ f_tld()
fi
fi
else
sort -u "${source}" > "${temp_tld}"
sort -T "${adb_sorttmpdir}" -u "${source}" > "${temp_tld}"
if [ "${?}" -eq 0 ]
then
mv -f "${temp_tld}" "${source}"
@ -960,7 +968,7 @@ f_main()
mem_total="$(awk '/^MemTotal/ {print int($2/1000)}' "/proc/meminfo" 2>/dev/null)"
mem_free="$(awk '/^MemFree/ {print int($2/1000)}' "/proc/meminfo" 2>/dev/null)"
f_log "debug" "f_main ::: dns: ${adb_dns}, fetch_util: ${adb_fetchinfo}, force_dns: ${adb_forcedns}, mem_total: ${mem_total:-0}, mem_free: ${mem_free:-0}, max_queue: ${adb_maxqueue}"
# main loop
#
f_list blacklist
@ -1179,8 +1187,8 @@ f_report()
if [ -s "${adb_repdir}/adb_report.raw" ]
then
awk '{printf("%s\t%s\t%s\t%s\t%s\t%s\n", $4,$5,$1,$2,$3,$4)}' "${adb_repdir}/adb_report.raw" | \
sort -ur | uniq -uf2 | awk '{currA=($6+0);currB=$6;currC=substr($6,length($6),1);
if(reqA==currB){reqA=0;printf("%s\t%s\n",d,$2)}else if(currC=="+"){reqA=currA;d=$3"\t"$4"\t"$5"\t"$2}}' | sort -ur > "${adb_repdir}/adb_report"
sort -T "${adb_sorttmpdir}" -ur | uniq -uf2 | awk '{currA=($6+0);currB=$6;currC=substr($6,length($6),1);
if(reqA==currB){reqA=0;printf("%s\t%s\n",d,$2)}else if(currC=="+"){reqA=currA;d=$3"\t"$4"\t"$5"\t"$2}}' | sort -T "${adb_sorttmpdir}" -ur > "${adb_repdir}/adb_report"
fi
if [ -s "${adb_repdir}/adb_report" ]
@ -1188,9 +1196,9 @@ f_report()
total="$(wc -l < "${adb_repdir}/adb_report")"
blocked="$(awk '{if($5=="NX")print $4}' "${adb_repdir}/adb_report" | wc -l)"
percent="$(awk -v t="${total}" -v b="${blocked}" 'BEGIN{printf("%.2f %s\n",b/t*100, "%")}')"
rep_clients="$(awk '{print $3}' "${adb_repdir}/adb_report" | sort | uniq -c | sort -r | awk '{ORS=" ";if(NR<=10) printf("%s_%s ",$1,$2)}')"
rep_domains="$(awk '{if($5!="NX")print $4}' "${adb_repdir}/adb_report" | sort | uniq -c | sort -r | awk '{ORS=" ";if(NR<=10)printf("%s_%s ",$1,$2)}')"
rep_blocked="$(awk '{if($5=="NX")print $4}' "${adb_repdir}/adb_report" | sort | uniq -c | sort -r | awk '{ORS=" ";if(NR<=10)printf("%s_%s ",$1,$2)}')"
rep_clients="$(awk '{print $3}' "${adb_repdir}/adb_report" | sort -T "${adb_sorttmpdir}" | uniq -c | sort -T "${adb_sorttmpdir}" -r | awk '{ORS=" ";if(NR<=10) printf("%s_%s ",$1,$2)}')"
rep_domains="$(awk '{if($5!="NX")print $4}' "${adb_repdir}/adb_report" | sort -T "${adb_sorttmpdir}" | uniq -c | sort -T "${adb_sorttmpdir}" -r | awk '{ORS=" ";if(NR<=10)printf("%s_%s ",$1,$2)}')"
rep_blocked="$(awk '{if($5=="NX")print $4}' "${adb_repdir}/adb_report" | sort -T "${adb_sorttmpdir}" | uniq -c | sort -T "${adb_sorttmpdir}" -r | awk '{ORS=" ";if(NR<=10)printf("%s_%s ",$1,$2)}')"
> "${adb_repdir}/adb_report.json"
json_load_file "${adb_repdir}/adb_report.json" >/dev/null 2>&1


Loading…
Cancel
Save