commit
830ef55886
4 changed files with 27 additions and 21 deletions
|
@ -7,7 +7,7 @@
|
|||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=adblock
|
||||
PKG_VERSION:=1.4.8
|
||||
PKG_VERSION:=1.4.9
|
||||
PKG_RELEASE:=1
|
||||
PKG_LICENSE:=GPL-3.0+
|
||||
PKG_MAINTAINER:=Dirk Brenken <dev@brenken.org>
|
||||
|
|
|
@ -185,21 +185,23 @@ config uhttpd 'main'
|
|||
|
||||
**example to query active blocklists for a certain (sub-)domain, i.e. for whitelisting:**
|
||||
<pre><code>
|
||||
/etc/init.d/adblock query "www.example.ad.where.com"
|
||||
=> results for (sub-)domain 'www.example.ad.where.com'
|
||||
/etc/init.d/adblock query "example.www.doubleclick.net"
|
||||
=> distinct results for domain 'example.www.doubleclick.net' (overall 0)
|
||||
no matches in active blocklists
|
||||
=> results for (sub-)domain 'example.ad.where.com'
|
||||
no matches in active blocklists
|
||||
=> results for (sub-)domain 'ad.where.com'
|
||||
/tmp/dnsmasq.d/adb_list.adaway:15:address=/ad.where.com/192.168.254.250
|
||||
=> results for (sub-)domain 'where.com'
|
||||
/tmp/dnsmasq.d/adb_list.adaway:15:address=/ad.where.com/192.168.254.250
|
||||
/tmp/dnsmasq.d/adb_list.hphosts:30264:address=/upstream.where.com/192.168.254.250
|
||||
/tmp/dnsmasq.d/adb_list.securemecca:4503:address=/paypal.adtag.where.com/192.168.254.250
|
||||
=> distinct results for domain 'www.doubleclick.net' (overall 1)
|
||||
adb_list.winhelp : www.doubleclick.net
|
||||
=> distinct results for domain 'doubleclick.net' (overall 252)
|
||||
adb_list.adaway : ad-g.doubleclick.net
|
||||
adb_list.hphosts : 1016557.fls.doubleclick.net
|
||||
adb_list.rolist : feedads.g.doubleclick.net
|
||||
adb_list.securemecca : 1168945.fls.doubleclick.net
|
||||
adb_list.sysctl : ad.co.doubleclick.net
|
||||
adb_list.whocares : 3ad.doubleclick.net
|
||||
adb_list.winhelp : 1435575.fls.doubleclick.net
|
||||
|
||||
The query function checks against the submitted (sub-)domain and recurse automatically to the (upper) top level domain.
|
||||
In the example above you have to whitelist "ad.where.com" to free the submitted (sub-)domain.
|
||||
For all matches (max. 3 per list) the query function returns the blocklist name, the line no. and the relevant (sub-)domain/host.
|
||||
The query function checks against the submitted (sub-)domain and recurses automatically to the upper top level domain(s).
|
||||
For every domain it returns the overall count plus a distinct list of active blocklists with the first relevant result.
|
||||
In the example above you have to whitelist "www.doubleclick.net" to free the submitted domain.
|
||||
</code></pre>
|
||||
|
||||
**example to identify blocked domains during web browsing, i.e. for whitelisting:**
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
#
|
||||
adb_pid="${$}"
|
||||
adb_pidfile="/var/run/adblock.pid"
|
||||
adb_scriptver="1.4.8"
|
||||
adb_scriptver="1.4.9"
|
||||
adb_mincfgver="2.5"
|
||||
adb_scriptdir="${0%/*}"
|
||||
if [ -r "${adb_pidfile}" ]
|
||||
|
|
|
@ -131,18 +131,22 @@ cfgup()
|
|||
|
||||
query()
|
||||
{
|
||||
local search
|
||||
local domain="${1}"
|
||||
local tld="${domain#*.}"
|
||||
if [ -z "${domain}" ] || [ "${domain}" = "${tld}" ]
|
||||
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 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
|
||||
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}'"
|
||||
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"
|
||||
|
|
Loading…
Reference in a new issue