Commit Graph

11 Commits

Author SHA1 Message Date
Robert McMahon ed6a2cd328 Add --tcpdump-capture (-T) for high-rate capture; document scapy drops
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-16 17:42:16 -08:00
Robert McMahon c192d911df Fix test capture frame numbering and subtype sort; code review fixes
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-13 16:01:29 -08:00
Robert McMahon 77fb5c69d4 Only show tcpdump message when tcpdump is available
- Check for tcpdump availability before printing startup message
- Show 'Note: tcpdump not found, skipping concurrent count' when unavailable
- Prevents confusing message when tcpdump is not installed

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-13 15:51:57 -08:00
Robert McMahon 1ef363f644 Improve tcpdump counter error handling and debugging
- Add detailed error messages when tcpdump fails or produces no output
- Show tcpdump stderr output for debugging filter issues
- Return 0 instead of None when tcpdump finds 0 packets (so it's displayed)
- Handle SIGTERM return code properly (expected when terminating)
- Display tcpdump count even when 0 to help diagnose issues
- Add note when tcpdump counter is unavailable

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-13 15:50:21 -08:00
Robert McMahon fc9b8c7f00 Add concurrent tcpdump counter for data frame comparison
- Run tcpdump concurrently with scapy to count data frames
- Use BPF filter (wlan[0] & 0x0C == 0x08) to filter data frames only
- Display comparison between scapy and tcpdump data frame counts
- Show capture ratio to identify if scapy is missing packets
- Add re import for regex parsing of tcpdump output

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-13 15:47:50 -08:00
Robert McMahon e52cd355e7 Change duration argument to time and add timestamps to sample packets
- Change CLI argument from -d/--duration to -t/--time
- Add timestamps with milliseconds to sample packets output
- Update all documentation examples to use --time/-t
- Format timestamps as HH:MM:SS.mmm for better readability

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-13 15:44:16 -08:00
Robert McMahon 12c57df2a2 Refactor CLI to use argparse key-value pairs and improve data frame analysis
- Replace custom argument parsing with argparse for better CLI design
- Use key-value pairs: --interface/-i, --channel/-c, --duration/-d, --pcap
- Remove iperf-specific references (server MAC analysis, iperf mentions)
- Improve data frame subtype detection for encrypted frames
- Add _get_subtype_from_fc() to parse Frame Control field directly
- Show data frame subtype breakdown in analysis output
- Add better debugging when QoS Data frames aren't found
- Maintain backward compatibility for positional pcap file argument

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-13 15:40:08 -08:00
Robert McMahon 9ff3cb9793 Fix async subprocess communication and remove unsupported snaplen parameter
- Fix async subprocess.communicate() usage: await before unpacking tuple
  Changed from: stderr = await proc.communicate()[1]
  To: _, stderr = await proc.communicate()
- Remove snaplen parameter from sniff() calls (not supported for live interface capture)
- Update messages to reflect that full packets are captured for live capture
- Remove redundant proc.wait() calls after communicate()

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-13 15:36:19 -08:00
Robert McMahon 96aab517af fix communicate and await 2026-02-13 15:34:47 -08:00
Robert McMahon e09456aab9 Refactor MonitorModeSetup to WiFiMonitor with async start/stop methods
- Rename MonitorModeSetup class to WiFiMonitor (better naming)
- Add async start() method for setting up monitor mode
- Add async stop() method for restoring interface to managed mode
- Convert all subprocess calls to async (asyncio.create_subprocess_exec)
- Add is_started property to track monitor mode state
- Update capture methods to use async implementation
- Use try/finally to ensure proper cleanup
- Run blocking scapy sniff() calls in executor for async compatibility
- Improve error handling with proper stderr communication

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-13 15:30:13 -08:00
Robert McMahon b67107e53e Refactor WiFi monitor script: improve code quality and rename
- Rename test_monitor.py to wifi_monitor.py (better naming)
- Delete parse_tshark_pcap.py (deprecated, replaced by wifi_monitor.py)
- Refactor to class-based architecture for better modularity:
  * Config: Configuration management
  * MonitorModeSetup: Monitor mode setup operations
  * PacketParser: Packet parsing utilities
  * PacketAnalyzer: Packet analysis and statistics
  * PacketCapture: Capture operations (PCAP and live)
  * ArgumentParser: Command line argument parsing
- Add properties where appropriate (snaplen, is_successful, error_message)
- Remove 'get_' prefix from utility methods (Python convention)
- Fix Python convention violations:
  * Replace wildcard imports with explicit imports
  * Use specific exception types instead of bare Exception
  * Organize imports (stdlib, third-party)
  * Remove unused imports
- Single exit point pattern throughout code
- Remove trailing whitespace

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-13 15:19:18 -08:00