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 <dev@brenken.org>
This commit is contained in:
parent
6bae8487ef
commit
1d8d456a55
2 changed files with 5 additions and 3 deletions
|
@ -7,7 +7,7 @@ include $(TOPDIR)/rules.mk
|
||||||
|
|
||||||
PKG_NAME:=adblock
|
PKG_NAME:=adblock
|
||||||
PKG_VERSION:=4.0.4
|
PKG_VERSION:=4.0.4
|
||||||
PKG_RELEASE:=1
|
PKG_RELEASE:=2
|
||||||
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>
|
||||||
|
|
||||||
|
|
|
@ -1467,7 +1467,9 @@ f_report()
|
||||||
if [ -s "${adb_reportdir}/adb_report.raw" ]
|
if [ -s "${adb_reportdir}/adb_report.raw" ]
|
||||||
then
|
then
|
||||||
sort ${adb_srtopts} -k1 -k3 -k4 -k5 -k1 -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}}' | \
|
||||||
|
sort ${adb_srtopts} -k1 -k2 -k3 -k4 -ur > "${adb_reportdir}/adb_report.srt"
|
||||||
|
rm -f "${adb_reportdir}/adb_report.raw"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -s "${adb_reportdir}/adb_report.srt" ]
|
if [ -s "${adb_reportdir}/adb_report.srt" ]
|
||||||
|
@ -1510,8 +1512,8 @@ f_report()
|
||||||
search="${search//./\\.}"
|
search="${search//./\\.}"
|
||||||
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"
|
"${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
|
fi
|
||||||
rm -f "${adb_reportdir}/adb_report.raw" "${adb_reportdir}/adb_report.srt"
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -s "${adb_reportdir}/adb_report.json" ]
|
if [ -s "${adb_reportdir}/adb_report.json" ]
|
||||||
|
|
Loading…
Reference in a new issue