mirror of
https://github.com/novatiq/packages.git
synced 2026-04-30 07:28:39 +01:00
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
Signed-off-by: Dirk Brenken <dev@brenken.org>
This commit is contained in:
@@ -131,12 +131,27 @@ cfgup()
|
||||
|
||||
query()
|
||||
{
|
||||
if [ -z "${1}" ]
|
||||
local search
|
||||
local domain="${1}"
|
||||
local tld="${domain#*.}"
|
||||
if [ -z "${domain}" ] || [ "${domain}" = "${tld}" ]
|
||||
then
|
||||
f_log "no domain query input, please submit a specific search domain"
|
||||
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 -Hnm 3 "[/\.]${search}/" "/tmp/dnsmasq.d/adb_list"* | sed -e 's/^/ /')"
|
||||
printf "%s\n" "=> results for (sub-)domain '${domain}'"
|
||||
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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user