* small fixes & cosmetics (missed in last commit)
Signed-off-by: Dirk Brenken <dev@brenken.org>
include $(TOPDIR)/rules.mk
PKG_NAME:=adblock
include $(TOPDIR)/rules.mk
PKG_NAME:=adblock
PKG_RELEASE:=1
PKG_LICENSE:=GPL-3.0+
PKG_MAINTAINER:=Dirk Brenken <dev@brenken.org>
PKG_RELEASE:=1
PKG_LICENSE:=GPL-3.0+
PKG_MAINTAINER:=Dirk Brenken <dev@brenken.org>
"data": {
"active_lists": [
{
"data": {
"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"
#
LC_ALL=C
PATH="/usr/sbin:/usr/bin:/sbin:/bin"
#
LC_ALL=C
PATH="/usr/sbin:/usr/bin:/sbin:/bin"
adb_enabled=1
adb_debug=0
adb_whitelist="/etc/adblock/adblock.whitelist"
adb_enabled=1
adb_debug=0
adb_whitelist="/etc/adblock/adblock.whitelist"
{
# check 'enabled' option
#
{
# check 'enabled' option
#
- if [ "${adb_enabled}" != "1" ]
+ if [ ${adb_enabled} -ne 1 ]
then
if [ "$(ls -dA "${adb_dnsdir}/${adb_dnsprefix}"* >/dev/null 2>&1)" ]
then
then
if [ "$(ls -dA "${adb_dnsdir}/${adb_dnsprefix}"* >/dev/null 2>&1)" ]
then
then
awk "${adb_whitelist_rset}" "${adb_whitelist}" > "${adb_tmpdir}/tmp.whitelist"
fi
then
awk "${adb_whitelist_rset}" "${adb_whitelist}" > "${adb_tmpdir}/tmp.whitelist"
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
logger -t "adblock-[${adb_ver}] ${class}" "${log_msg}"
if [ "${class}" = "error" ]
then
logger -t "adblock-[${adb_ver}] ${class}" "${log_msg}"
if [ "${class}" = "error" ]
then
f_rmtemp
f_rmdns
f_dnsrestart
f_rmtemp
f_rmdns
f_dnsrestart
f_main()
{
local enabled url rc cnt sum_cnt=0
f_main()
{
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_log "debug" "main ::: tool: ${adb_fetch}, parm: ${adb_fetchparm}"
f_debug
f_log "debug" "main ::: tool: ${adb_fetch}, parm: ${adb_fetchparm}"
cnt="$(wc -l < "${src_name}")"
sum_cnt=$((sum_cnt + cnt))
list="${src_name/*./}"
cnt="$(wc -l < "${src_name}")"
sum_cnt=$((sum_cnt + cnt))
list="${src_name/*./}"
- if [ -z "${sum_list}" ]
+ if [ -z "${active_lists}" ]
- sum_list="\"${list}\":\"${cnt}\""
+ active_lists="\"${list}\":\"${cnt}\""
- sum_list="${sum_list},\"${list}\":\"${cnt}\""
+ active_lists="${active_lists},\"${list}\":\"${cnt}\""
- 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
- 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