adblock: update 4.0.4
* add 'ca-bundle' dependency * fix a sort bug in report engine * fix potential bugs in the f_extconf function Signed-off-by: Dirk Brenken <dev@brenken.org>
This commit is contained in:
parent
ed903bfd57
commit
d6634b611a
2 changed files with 15 additions and 25 deletions
|
@ -6,7 +6,7 @@
|
||||||
include $(TOPDIR)/rules.mk
|
include $(TOPDIR)/rules.mk
|
||||||
|
|
||||||
PKG_NAME:=adblock
|
PKG_NAME:=adblock
|
||||||
PKG_VERSION:=4.0.3
|
PKG_VERSION:=4.0.4
|
||||||
PKG_RELEASE:=1
|
PKG_RELEASE:=1
|
||||||
PKG_LICENSE:=GPL-3.0-or-later
|
PKG_LICENSE:=GPL-3.0-or-later
|
||||||
PKG_MAINTAINER:=Dirk Brenken <dev@brenken.org>
|
PKG_MAINTAINER:=Dirk Brenken <dev@brenken.org>
|
||||||
|
@ -17,7 +17,7 @@ define Package/adblock
|
||||||
SECTION:=net
|
SECTION:=net
|
||||||
CATEGORY:=Network
|
CATEGORY:=Network
|
||||||
TITLE:=Powerful adblock script to block ad/abuse domains by using DNS
|
TITLE:=Powerful adblock script to block ad/abuse domains by using DNS
|
||||||
DEPENDS:=+jshn +jsonfilter +coreutils +coreutils-sort
|
DEPENDS:=+jshn +jsonfilter +coreutils +coreutils-sort +ca-bundle
|
||||||
PKGARCH:=all
|
PKGARCH:=all
|
||||||
endef
|
endef
|
||||||
|
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
export LC_ALL=C
|
export LC_ALL=C
|
||||||
export PATH="/usr/sbin:/usr/bin:/sbin:/bin"
|
export PATH="/usr/sbin:/usr/bin:/sbin:/bin"
|
||||||
set -o pipefail
|
set -o pipefail
|
||||||
adb_ver="4.0.3"
|
adb_ver="4.0.4"
|
||||||
adb_enabled=0
|
adb_enabled=0
|
||||||
adb_debug=0
|
adb_debug=0
|
||||||
adb_forcedns=0
|
adb_forcedns=0
|
||||||
|
@ -555,38 +555,27 @@ f_count()
|
||||||
#
|
#
|
||||||
f_extconf()
|
f_extconf()
|
||||||
{
|
{
|
||||||
local config instance port fwcfg
|
local config config_dir config_file port fwcfg
|
||||||
|
|
||||||
case "${adb_dns}" in
|
case "${adb_dns}" in
|
||||||
"dnsmasq")
|
"dnsmasq")
|
||||||
config="dhcp"
|
config="dhcp"
|
||||||
for instance in ${adb_dnsinstance}
|
config_dir="$(uci_get dhcp "@dnsmasq[${adb_dnsinstance}]" confdir | grep -Fo "${adb_dnsdir}")"
|
||||||
do
|
if [ "${adb_enabled}" -eq 1 ] && [ -z "${config_dir}" ]
|
||||||
if [ "${adb_enabled}" -eq 1 ] && [ -z "$(uci_get dhcp "@dnsmasq[${instance}]" confdir | grep -Fo "${adb_dnsdir}")" ]
|
then
|
||||||
then
|
uci_set dhcp "@dnsmasq[${adb_dnsinstance}]" confdir "${adb_dnsdir}" 2>/dev/null
|
||||||
uci_set dhcp "@dnsmasq[${instance}]" confdir "${adb_dnsdir}"
|
fi
|
||||||
elif [ "${adb_enabled}" -eq 0 ] && [ -n "$(uci_get dhcp "@dnsmasq[${instance}]" confdir | grep -Fo "${adb_dnsdir}")" ]
|
|
||||||
then
|
|
||||||
uci_remove dhcp "@dnsmasq[${instance}]" confdir
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
;;
|
;;
|
||||||
"kresd")
|
"kresd")
|
||||||
config="resolver"
|
config="resolver"
|
||||||
if [ "${adb_enabled}" -eq 1 ] && [ -z "$(uci_get resolver kresd rpz_file | grep -Fo "${adb_dnsdir}/${adb_dnsfile}")" ]
|
config_file="$(uci_get resolver kresd rpz_file | grep -Fo "${adb_dnsdir}/${adb_dnsfile}")"
|
||||||
|
if [ "${adb_enabled}" -eq 1 ] && [ -z "${config_file}" ]
|
||||||
then
|
then
|
||||||
uci -q add_list resolver.kresd.rpz_file="${adb_dnsdir}/${adb_dnsfile}"
|
uci -q add_list resolver.kresd.rpz_file="${adb_dnsdir}/${adb_dnsfile}"
|
||||||
elif [ "${adb_enabled}" -eq 0 ] && [ -n "$(uci_get resolver kresd rpz_file | grep -Fo "${adb_dnsdir}/${adb_dnsfile}")" ]
|
elif [ "${adb_enabled}" -eq 0 ] && [ -n "${config_file}" ]
|
||||||
then
|
then
|
||||||
uci -q del_list resolver.kresd.rpz_file="${adb_dnsdir}/${adb_dnsfile}"
|
uci -q del_list resolver.kresd.rpz_file="${adb_dnsdir}/${adb_dnsfile}"
|
||||||
fi
|
fi
|
||||||
if [ "${adb_enabled}" -eq 1 ] && [ "${adb_dnsflush}" -eq 0 ] && [ "$(uci_get resolver kresd keep_cache)" != "1" ]
|
|
||||||
then
|
|
||||||
uci_set resolver kresd keep_cache "1"
|
|
||||||
elif [ "${adb_enabled}" -eq 0 ] || { [ "${adb_dnsflush}" -eq 1 ] && [ "$(uci_get resolver kresd keep_cache)" = "1" ]; }
|
|
||||||
then
|
|
||||||
uci_set resolver kresd keep_cache "0"
|
|
||||||
fi
|
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
f_uci "${config}"
|
f_uci "${config}"
|
||||||
|
@ -1464,7 +1453,8 @@ f_report()
|
||||||
do
|
do
|
||||||
(
|
(
|
||||||
"${adb_dumpcmd}" -tttt -r "${file}" 2>/dev/null | \
|
"${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"
|
"${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"
|
||||||
)&
|
)&
|
||||||
hold=$((cnt%adb_maxqueue))
|
hold=$((cnt%adb_maxqueue))
|
||||||
if [ "${hold}" -eq 0 ]
|
if [ "${hold}" -eq 0 ]
|
||||||
|
@ -1476,7 +1466,7 @@ f_report()
|
||||||
wait
|
wait
|
||||||
if [ -s "${adb_reportdir}/adb_report.raw" ]
|
if [ -s "${adb_reportdir}/adb_report.raw" ]
|
||||||
then
|
then
|
||||||
sort ${adb_srtopts} -k 3 -k 4 -k 5 -k 1 -ur "${adb_reportdir}/adb_report.raw" | \
|
sort ${adb_srtopts} -k1 -k3 -k4 -k5 -k1 -ur "${adb_reportdir}/adb_report.raw" | \
|
||||||
"${adb_awk}" '{currA=($1+0);currB=$1;currC=substr($1,length($1),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}}' > "${adb_reportdir}/adb_report.srt"
|
"${adb_awk}" '{currA=($1+0);currB=$1;currC=substr($1,length($1),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}}' > "${adb_reportdir}/adb_report.srt"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue