kill -9 $_PROCESS_ID#forcefully terminate the process, and any subprocesses or child processes, with the ID using the SIGKILL signal (sometimes it's not enough, why?)
exit0
}
### check_ret(prog_name, val_ret)
function check_ret()
{
notgood=0
case$1 in
"filtering_away")
if[$2 -ne 0];then
notgood=1
fi
;;
"print_results")
if[$2 -ne 0];then
notgood=1
fi
;;
*)echo -e "${WARNING}Setup success value returned for function \"$1\"${DEFAULT}"
return 1;;
esac
if[$notgood -eq 1];then
echo -e "${ERROR}Problem with the execution of \"$1\", exited with status $2${DEFAULT}"
fi
}
###
function filtering_away()
{
scope='wlan.ta'#filter for the main scope of divide randomized MAC and fixed ones.
done < <(paste -d ' '$_TMP/pipe1 $_TMP/pipe2 $_TMP/pipe3 $_TMP/pipe4)#the 'paste' command merges the lines of both named pipes and separates them with a space. the '< <' operator to redirect the merged output as input to the while loop.
rm -rf $_TMP#remove the temporary directory and all its contents recursively (-r) and without prompting (-f)
verbose_msg "=> $_PCKS_CNTR for no filter"
verbose_msg "=> $_PCKS_WLAN_CNTR for filter 'wlan'"
if ! [[$_SSID_REF=='']];then
verbose_msg "=> $_PCKS_SSID_CNTR for filter 'wlan.ssid == $_SSID_REF'"
fi
verbose_msg "=> $_SCOPE_ALL_CNTR for filter '$filter'"
_SCOPE_RAND_CNTR=$(cut -c 1-17 $_FILE2_TMP| awk '/^.[AE26]:..:..:..:..:../{print $1}'| sort | uniq | tee >(wc -l) >"$_FILE_TMP")#cut print selected parts of line. awk is used to consider only MAC specified(x[A E 2 6]:xx:xx:xx:xx:xx). sort+uniq remove the duplicates(seems useless but necessary). tee split the data in the pipe.
else
_SCOPE_RAND_CNTR=$(cut -c 1-17 $_FILE2_TMP| awk '/^.[AE26]:..:..:..:..:../{print $1}'| sort | uniq | wc -l)#cut print selected parts of line. awk is used to consider only MAC specified(x[A E 2 6]:xx:xx:xx:xx:xx). sort+uniq remove the duplicates(seems useless but necessary).
fi
else
if[[$_VERBOSE_FLAG=='true']];then
_SCOPE_RAND_CNTR=$(cut -c 1-17 $_FILE2_TMP| awk '/^.[AE26]:..:..:..:..:../{print $1}'| tee >(wc -l) >"$_FILE_TMP")#cut print selected parts of line. awk is used to consider only MAC specified(x[A E 2 6]:xx:xx:xx:xx:xx). tee split the data in the pipe.
else
_SCOPE_RAND_CNTR=$(cut -c 1-17 $_FILE2_TMP| awk '/^.[AE26]:..:..:..:..:../{print $1}'| wc -l)#cut print selected parts of line. awk is used to consider only MAC specified(x[A E 2 6]:xx:xx:xx:xx:xx).
# filter="($scope) && (wlan) $filterSSID" #save the complete filter which wanna use to split the data.
# rm -f $_FILE_TMP $_FILE2_TMP #just as a precaution.
# if [[ $_UNIQ_FLAG == 'true' ]]; then
# verbose_msg "Counting packets with filter '$filter' in $_FILE_REF"
# _SCOPE_ALL_CNTR=$(tshark -r $_FILE_REF -Y "$filter" -T fields -e wlan.ta -c $_MAX_TO | tr '[:lower:]' '[:upper:]' | sort | uniq | tee >(wc -l) >"$_FILE2_TMP") #for details see 'man tshark'. tr swap all upper-case. sort+uniq remove the duplicates. tee split the data in the pipe.
# verbose_msg "=> $_SCOPE_ALL_CNTR"
# if [[ $_VERBOSE_FLAG == 'true' ]]; then
# _SCOPE_RAND_CNTR=$(cut -c 1-17 $_FILE2_TMP | awk '/^.[AE26]:..:..:..:..:../{print $1}' | sort | uniq | tee >(wc -l) >"$_FILE_TMP") #cut print selected parts of line. awk is used to consider only MAC specified(x[A E 2 6]:xx:xx:xx:xx:xx). sort+uniq remove the duplicates(seems useless but necessary). tee split the data in the pipe.
# else
# _SCOPE_RAND_CNTR=$(cut -c 1-17 $_FILE2_TMP | awk '/^.[AE26]:..:..:..:..:../{print $1}' | sort | uniq | wc -l) #cut print selected parts of line. awk is used to consider only MAC specified(x[A E 2 6]:xx:xx:xx:xx:xx). sort+uniq remove the duplicates(seems useless but necessary).
# fi
# else
# verbose_msg "Counting packets with filter '$filter' in $_FILE_REF"
# _SCOPE_ALL_CNTR=$(tshark -r $_FILE_REF -Y "$filter" -T fields -e wlan.ta -e wlan.fc.type -c $_MAX_TO | tr '[:lower:]' '[:upper:]' | tee >(wc -l) >"$_FILE2_TMP") #for details see 'man tshark'. tr swap all upper-case. tee split the data in the pipe.
# verbose_msg "=> $_SCOPE_ALL_CNTR"
# if [[ $_VERBOSE_FLAG == 'true' ]]; then
# _SCOPE_RAND_CNTR=$(cut -c 1-17 $_FILE2_TMP | awk '/^.[AE26]:..:..:..:..:../{print $1}' | tee >(wc -l) >"$_FILE_TMP") #cut print selected parts of line. awk is used to consider only MAC specified(x[A E 2 6]:xx:xx:xx:xx:xx). tee split the data in the pipe.
# else
# _SCOPE_RAND_CNTR=$(cut -c 1-17 $_FILE2_TMP | awk '/^.[AE26]:..:..:..:..:../{print $1}' | wc -l) #cut print selected parts of line. awk is used to consider only MAC specified(x[A E 2 6]:xx:xx:xx:xx:xx).
echo -ne "\033[2J\033[H"#the "\033[2J" sequence clear the terminal screen, the "\033[H" sequence moves the cursor to the top left corner of the screen.
echo"$(cat $lock_print)"#The "$()" syntax is used to execute the command inside the parentheses and return the result as a string (used to handle print cases TO REVIEW)
if head -c4 | od -t x4 -N4 | grep -q -e "a1b2c3d4" -e "d4c3b2a1" -e "0a0d0d0a";then#handled only pcap, pcapng files (not erf ...) using magic number of file.
if ! head -c4 $_FILE_REF| od -t x4 -N4 | grep -q -e "a1b2c3d4" -e "d4c3b2a1" -e "0a0d0d0a";then#handled only pcap, pcapng files (not erf ...) using magic number of file.