From 1d8d456a55a3135de59731640c58d4c222738036 Mon Sep 17 00:00:00 2001 From: Dirk Brenken Date: Mon, 13 Apr 2020 06:16:03 +0200 Subject: [PATCH] adblock: fix another reporting bug * add a final sort step, this fixes dns reporting with multiple pcap files as input Signed-off-by: Dirk Brenken --- net/adblock/Makefile | 2 +- net/adblock/files/adblock.sh | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/net/adblock/Makefile b/net/adblock/Makefile index c37e3bbd88..1ddb3a09af 100644 --- a/net/adblock/Makefile +++ b/net/adblock/Makefile @@ -7,7 +7,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=adblock PKG_VERSION:=4.0.4 -PKG_RELEASE:=1 +PKG_RELEASE:=2 PKG_LICENSE:=GPL-3.0-or-later PKG_MAINTAINER:=Dirk Brenken diff --git a/net/adblock/files/adblock.sh b/net/adblock/files/adblock.sh index b7e7d64c66..4f24a3ddce 100755 --- a/net/adblock/files/adblock.sh +++ b/net/adblock/files/adblock.sh @@ -1467,7 +1467,9 @@ f_report() if [ -s "${adb_reportdir}/adb_report.raw" ] then 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}}' | \ + sort ${adb_srtopts} -k1 -k2 -k3 -k4 -ur > "${adb_reportdir}/adb_report.srt" + rm -f "${adb_reportdir}/adb_report.raw" fi if [ -s "${adb_reportdir}/adb_report.srt" ] @@ -1510,8 +1512,8 @@ f_report() search="${search//./\\.}" search="${search//[+*~%\$&\"\' ]/}" "${adb_awk}" "BEGIN{i=0;printf \"%s\",\"\\\"requests\\\": [ \" }/(${search})/{i++;if(i==1)printf \"\{ \\\"date\\\": \\\"%s\\\", \\\"time\\\": \\\"%s\\\", \\\"client\\\": \\\"%s\\\", \\\"domain\\\": \\\"%s\\\", \\\"rc\\\": \\\"%s\\\" }\",\$1,\$2,\$3,\$4,\$5;else if(i<=${count})printf \", { \\\"date\\\": \\\"%s\\\", \\\"time\\\": \\\"%s\\\", \\\"client\\\": \\\"%s\\\", \\\"domain\\\": \\\"%s\\\", \\\"rc\\\": \\\"%s\\\" }\",\$1,\$2,\$3,\$4,\$5}END{printf \"%s\" \" \] } }\n\"}" "${adb_reportdir}/adb_report.srt" >> "${adb_reportdir}/adb_report.json" + rm -f "${adb_reportdir}/adb_report.srt" fi - rm -f "${adb_reportdir}/adb_report.raw" "${adb_reportdir}/adb_report.srt" fi if [ -s "${adb_reportdir}/adb_report.json" ] -- 2.30.2