@ -54,6 +54,7 @@ adb_repiface=""
adb_replisten = "53"
adb_replisten = "53"
adb_repchunkcnt = "5"
adb_repchunkcnt = "5"
adb_repchunksize = "1"
adb_repchunksize = "1"
adb_represolve = "0"
adb_lookupdomain = "example.com"
adb_lookupdomain = "example.com"
adb_action = " ${ 1 :- "start" } "
adb_action = " ${ 1 :- "start" } "
adb_packages = ""
adb_packages = ""
@ -1653,7 +1654,7 @@ f_main()
#
#
f_report( )
f_report( )
{
{
local report_raw report_json report_txt content status total start end blocked percent top_list top array item index hold ports value key key_list cnt = 0 action = " ${ 1 } " count = " ${ 2 :- "50" } " search = " ${ 3 :- "+" } "
local report_raw report_json report_txt content status total start end blocked percent top_list top array item index hold ports value key key_list cnt = 0 resolve = "-nn" action = " ${ 1 } " count = " ${ 2 :- "50" } " search = " ${ 3 :- "+" } "
report_raw = " ${ adb_reportdir } /adb_report.raw "
report_raw = " ${ adb_reportdir } /adb_report.raw "
report_srt = " ${ adb_reportdir } /adb_report.srt "
report_srt = " ${ adb_reportdir } /adb_report.srt "
@ -1668,10 +1669,14 @@ f_report()
> " ${ report_srt } "
> " ${ report_srt } "
> " ${ report_txt } "
> " ${ report_txt } "
> " ${ report_jsn } "
> " ${ report_jsn } "
if [ " ${ adb_represolve } " = "1" ]
then
resolve = ""
fi
for file in " ${ adb_reportdir } /adb_report.pcap " *
for file in " ${ adb_reportdir } /adb_report.pcap " *
do
do
(
(
" ${ adb_dumpcmd } " -nn -tttt -r " ${ file } " 2>/dev/null | \
" ${ adb_dumpcmd } " " ${ resolve } " -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) ; gsub( /[ ^[ :alnum:] \. :-] /,"" ,c) ; d = cnt $7 ; sub( /\* $/,"" ,d) ;
" ${ 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) ; gsub( /[ ^[ :alnum:] \. :-] /,"" ,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) ; gsub( /[ ^[ :alnum:] \. -] /,"" ,e) ; if ( e = = "" ) { e = "err" } ; printf "%s\t%s\t%s\t%s\t%s\n" ,d,e,a,b,c} ' >> " ${ report_raw } "
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) ; gsub( /[ ^[ :alnum:] \. -] /,"" ,e) ; if ( e = = "" ) { e = "err" } ; printf "%s\t%s\t%s\t%s\t%s\n" ,d,e,a,b,c} ' >> " ${ report_raw } "
) &
) &
@ -1810,7 +1815,7 @@ f_report()
( " ${ adb_mailservice } " " ${ adb_ver } " " ${ content } " >/dev/null 2>& 1 ) &
( " ${ adb_mailservice } " " ${ adb_ver } " " ${ content } " >/dev/null 2>& 1 ) &
bg_pid = " ${ ! } "
bg_pid = " ${ ! } "
fi
fi
f_log "debug" " f_report ::: action: ${ action } , count: ${ count } , search: ${ search } , dump_util: ${ adb_dumpcmd } , rep_dir: ${ adb_reportdir } , rep_iface: ${ adb_repiface :- "-" } , rep_listen: ${ adb_replisten } , rep_chunksize: ${ adb_repchunksize } , rep_chunkcnt: ${ adb_repchunkcnt } "
f_log "debug" " f_report ::: action: ${ action } , count: ${ count } , search: ${ search } , dump_util: ${ adb_dumpcmd } , rep_dir: ${ adb_reportdir } , rep_iface: ${ adb_repiface :- "-" } , rep_listen: ${ adb_replisten } , rep_chunksize: ${ adb_repchunksize } , rep_chunkcnt: ${ adb_repchunkcnt } , rep_resolve: ${ adb_represolve } "
}
}
# source required system libraries
# source required system libraries