diff --git a/test_monitor_tshark.sh b/test_monitor_tshark.sh index 520715e..6409c22 100755 --- a/test_monitor_tshark.sh +++ b/test_monitor_tshark.sh @@ -97,10 +97,13 @@ PACKET_COUNT=$(echo "$PACKET_LINES" | wc -l || echo "0") # Count lines with both frame.number and radiotap.present (non-empty second field) PLCP_COUNT=$(echo "$PACKET_LINES" | awk -F'\t' 'NF >= 2 && $1 != "" && $2 != "" && $2 != "0" && $2 != "-" {count++} END {print count+0}' || echo "0") -# Show sample output +# Show sample output with better formatting if [ "$PACKET_COUNT" -gt 0 ]; then echo "Sample packets:" - echo "$PACKET_LINES" | head -3 + echo "$PACKET_LINES" | head -5 | awk -F'\t' '{ + radiotap = ($2 == "1" || $2 == "1.0") ? "yes" : "no" + printf " Frame %s: PLCP header (radiotap) = %s\n", $1, radiotap + }' fi echo "" @@ -165,10 +168,18 @@ if [ "$FINAL_COUNT" -gt 0 ]; then fi echo "" -# Display sample packets +# Display sample packets with readable format if [ -n "$PACKET_LINES" ] && [ "$FINAL_COUNT" -gt 0 ]; then - echo "Sample packets (first 20):" - echo "$PACKET_LINES" | head -20 + echo "Sample packets (first 10):" + echo "$PACKET_LINES" | head -10 | awk -F'\t' '{ + sa = ($3 != "" && $3 != "-") ? $3 : "N/A" + da = ($4 != "" && $4 != "-") ? $4 : "N/A" + type = ($5 != "" && $5 != "-") ? $5 : "N/A" + subtype = ($6 != "" && $6 != "-") ? $6 : "N/A" + radiotap = ($8 == "1" || $8 == "1.0") ? "yes" : (($8 != "" && $8 != "-") ? "no" : "N/A") + printf " Frame %s: SA=%s, DA=%s, type=%s/%s, PLCP=%s\n", + $1, sa, da, type, subtype, radiotap + }' echo "" else echo "(No packets captured)"