adblock: update to 1.4.9

Apply adblock updates 1.4.8-1.4.9

Signed-off-by: Hannu Nyman <hannu.nyman@iki.fi>

Original commit messages:

adblock: update 1.4.8
* enhance the new query function:
   change the regex to find only the relevant blocklist entries
   add a recursive tld search to quickly identify domains for
whitelisting (see documentation)
     better result preparation
* add securemecca as new blocklist source
* documentation update

adblock: update 1.4.9
* refine query function (see online doc)
This commit is contained in:
Dirk Brenken
2016-09-19 15:59:33 +03:00
committed by Hannu Nyman
parent 70594d1749
commit 71aedf440b
5 changed files with 78 additions and 29 deletions
+23 -4
View File
@@ -131,12 +131,31 @@ cfgup()
query()
{
if [ -z "${1}" ]
domain="${1}"
tld="${domain#*.}"
list_dns="$(find "${adb_dnsdir}" -maxdepth 1 -type f -name "${adb_dnsprefix}*" -print)"
if [ -z "${list_dns}" ]
then
f_log "no domain query input, please submit a specific search domain"
f_log "no active blocklists found, please start adblock first"
elif [ -z "${domain}" ] || [ "${domain}" = "${tld}" ]
then
f_log "invalid domain query input, please submit a specific (sub-)domain, i.e. 'www.abc.xyz'"
else
f_log "results for search domain '${1}':"
grep "${1}" "/tmp/dnsmasq.d/adb_list"*
while [ "${domain}" != "${tld}" ]
do
search="${domain//./\.}"
result="$(grep -Hm 1 "[/\.]${search}/" "${adb_dnsdir}/adb_list"* | awk -F ':|/' '{print " "$4"\t: "$6}')"
count="$(grep -hc "[/\.]${search}/" "${adb_dnsdir}/adb_list"* | awk '{sum += $1} END {printf sum}')"
printf "%s\n" "=> distinct results for domain '${domain}' (overall ${count})"
if [ -z "${result}" ]
then
printf "%s\n" " no matches in active blocklists"
else
printf "%s\n" "${result}"
fi
domain="${tld}"
tld="${domain#*.}"
done
fi
return 0
}