From 8d607a5f66bc8a1e42f8b3687e8ad0053e75848c Mon Sep 17 00:00:00 2001 From: Robert McMahon Date: Fri, 13 Feb 2026 13:56:46 -0800 Subject: [PATCH] Improve packet display formatting in test_monitor_tshark.sh - Replace raw tab-separated values with readable format - Show 'Frame X: PLCP header (radiotap) = yes/no' instead of '1 1' - Add field labels for main capture sample packets - Show SA, DA, type, subtype, and PLCP status in readable format Co-authored-by: Cursor --- test_monitor_tshark.sh | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) 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)"