Browse Source

Merge pull request #3726 from dibdot/adblock

adblock: update 2.0.4
lilik-openwrt-22.03
Hannu Nyman 8 years ago
committed by GitHub
parent
commit
f90396ee0f
3 changed files with 40 additions and 24 deletions
  1. +1
    -1
      net/adblock/Makefile
  2. +23
    -5
      net/adblock/files/README.md
  3. +16
    -18
      net/adblock/files/adblock.sh

+ 1
- 1
net/adblock/Makefile View File

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


+ 23
- 5
net/adblock/files/README.md View File

@ -157,13 +157,31 @@ This will output the active block lists, the overall domain count and the last r
"data": { "data": {
"active_lists": [ "active_lists": [
{ {
"adaway": "409",
"yoyo": "2368",
"disconnect": "3198"
"palevo": "14",
"blacklist": "143",
"winspy": "164",
"zeus": "446",
"rolist": "644",
"malwarelist": "1218",
"openphish": "1515",
"ransomware": "1463",
"ruadlist": "1773",
"yoyo": "2320",
"dshield": "123",
"disconnect": "3181",
"spam404": "6155",
"malware": "9882",
"whocares": "11825",
"winhelp": "10917",
"sysctl": "8529",
"securemecca": "9919",
"shalla": "25779",
"hphosts": "37111"
} }
], ],
"blocked_domains": "5975",
"last_rundate": "30.12.2016 21:03:45"
"blocked_domains": "133121",
"last_rundate": "31.12.2016 07:19:25",
"system": "LEDE Reboot SNAPSHOT r2709-b7677f05d6"
} }
} }
} }


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

@ -10,7 +10,7 @@
# #
LC_ALL=C LC_ALL=C
PATH="/usr/sbin:/usr/bin:/sbin:/bin" PATH="/usr/sbin:/usr/bin:/sbin:/bin"
adb_ver="2.0.3"
adb_ver="2.0.4"
adb_enabled=1 adb_enabled=1
adb_debug=0 adb_debug=0
adb_whitelist="/etc/adblock/adblock.whitelist" adb_whitelist="/etc/adblock/adblock.whitelist"
@ -86,7 +86,7 @@ f_envcheck()
{ {
# check 'enabled' option # check 'enabled' option
# #
if [ "${adb_enabled}" != "1" ]
if [ ${adb_enabled} -ne 1 ]
then then
if [ "$(ls -dA "${adb_dnsdir}/${adb_dnsprefix}"* >/dev/null 2>&1)" ] if [ "$(ls -dA "${adb_dnsdir}/${adb_dnsprefix}"* >/dev/null 2>&1)" ]
then then
@ -125,10 +125,6 @@ f_envcheck()
then then
awk "${adb_whitelist_rset}" "${adb_whitelist}" > "${adb_tmpdir}/tmp.whitelist" awk "${adb_whitelist_rset}" "${adb_whitelist}" > "${adb_tmpdir}/tmp.whitelist"
fi fi
# get system information
#
adb_sysver="$(ubus -S call system board | jsonfilter -e '@.release.description')"
} }
# f_rmtemp: remove temporary files & directories # f_rmtemp: remove temporary files & directories
@ -279,7 +275,6 @@ f_log()
logger -t "adblock-[${adb_ver}] ${class}" "${log_msg}" logger -t "adblock-[${adb_ver}] ${class}" "${log_msg}"
if [ "${class}" = "error" ] if [ "${class}" = "error" ]
then then
f_debug
f_rmtemp f_rmtemp
f_rmdns f_rmdns
f_dnsrestart f_dnsrestart
@ -317,7 +312,8 @@ f_debug()
f_main() f_main()
{ {
local enabled url rc cnt sum_cnt=0 local enabled url rc cnt sum_cnt=0
local src_name src_rset shalla_file shalla_archive
local src_name src_rset shalla_file shalla_archive list active_lists
local sysver="$(ubus -S call system board | jsonfilter -e '@.release.description')"
f_debug f_debug
f_log "debug" "main ::: tool: ${adb_fetch}, parm: ${adb_fetchparm}" f_log "debug" "main ::: tool: ${adb_fetch}, parm: ${adb_fetchparm}"
@ -421,11 +417,11 @@ f_main()
cnt="$(wc -l < "${src_name}")" cnt="$(wc -l < "${src_name}")"
sum_cnt=$((sum_cnt + cnt)) sum_cnt=$((sum_cnt + cnt))
list="${src_name/*./}" list="${src_name/*./}"
if [ -z "${sum_list}" ]
if [ -z "${active_lists}" ]
then then
sum_list="\"${list}\":\"${cnt}\""
active_lists="\"${list}\":\"${cnt}\""
else else
sum_list="${sum_list},\"${list}\":\"${cnt}\""
active_lists="${active_lists},\"${list}\":\"${cnt}\""
fi fi
done done
f_dnsrestart f_dnsrestart
@ -433,15 +429,17 @@ f_main()
then then
f_debug f_debug
f_rmtemp f_rmtemp
f_log "info " "status ::: block lists with overall ${sum_cnt} domains loaded (${adb_sysver})"
f_log "info " "status ::: block lists with overall ${sum_cnt} domains loaded (${sysver})"
ubus call service add "{\"name\":\"adblock_stats\", ubus call service add "{\"name\":\"adblock_stats\",
\"instances\":{\"stats\":{\"command\":[\"\"],
\"data\":{\"blocked_domains\":\"${sum_cnt}\",
\"last_rundate\":\"$(/bin/date "+%d.%m.%Y %H:%M:%S")\",
\"active_lists\":[{${sum_list}}]}}}}"
exit 0
\"instances\":{\"stats\":{\"command\":[\"\"],
\"data\":{\"blocked_domains\":\"${sum_cnt}\",
\"last_rundate\":\"$(/bin/date "+%d.%m.%Y %H:%M:%S")\",
\"active_lists\":[{${active_lists}}],
\"system\":\"${sysver}\"}}}}"
return 0
fi fi
f_log "error" "status ::: dns server restart with active block lists failed"
f_debug
f_log "error" "status ::: dns server restart with active block lists failed (${sysver})"
} }
# handle different adblock actions # handle different adblock actions


Loading…
Cancel
Save