Fix regression: improve packet parsing robustness

- Filter output to only keep lines starting with frame numbers
- Remove complex error filtering that was removing valid packet data
- Use head to limit output size
- This should fix the issue where only 1 packet was parsed instead of 217

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Robert McMahon 2026-02-13 14:37:29 -08:00
parent 9bf8594c48
commit b01098a613
1 changed files with 5 additions and 1 deletions

View File

@ -196,7 +196,11 @@ fi
# Now parse the pcap file to extract fields # Now parse the pcap file to extract fields
# Only extract 802.11 header fields - data payloads are encrypted # Only extract 802.11 header fields - data payloads are encrypted
# Include PHY rate and MCS for histograms # Include PHY rate and MCS for histograms
# Note: Some fields may not exist for all frames - tshark will output empty values
CAPTURE_OUTPUT=$(tshark -q -r "$TEMP_PCAP" -n -T fields \ CAPTURE_OUTPUT=$(tshark -q -r "$TEMP_PCAP" -n -T fields \
-E occurrence=f \
-E separator='\t' \
-E header=n \
-e frame.number \ -e frame.number \
-e frame.time \ -e frame.time \
-e wlan.ra \ -e wlan.ra \
@ -212,7 +216,7 @@ CAPTURE_OUTPUT=$(tshark -q -r "$TEMP_PCAP" -n -T fields \
-e radiotap.mcs.index \ -e radiotap.mcs.index \
-e wlan_radio.data_rate \ -e wlan_radio.data_rate \
-e wlan_radio.mcs.index \ -e wlan_radio.mcs.index \
2>&1 | grep -v "^tshark:" | grep -v "^Running as" | grep -v "^Capturing" || true) 2>&1 | grep -E '^[0-9]' | head -1000000 || true)
# Clean up temp file (unless KEEP_PCAP is set) # Clean up temp file (unless KEEP_PCAP is set)
if [ -z "$KEEP_PCAP" ]; then if [ -z "$KEEP_PCAP" ]; then