Fix test capture frame numbering and subtype sort; code review fixes
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
parent
77fb5c69d4
commit
c192d911df
|
|
@ -430,15 +430,15 @@ class CaptureAnalyzer:
|
||||||
scapy_data_count = sum(1 for pkt in packets if pkt.haslayer(Dot11) and pkt[Dot11].type == 2)
|
scapy_data_count = sum(1 for pkt in packets if pkt.haslayer(Dot11) and pkt[Dot11].type == 2)
|
||||||
|
|
||||||
if tcpdump_data_count is not None:
|
if tcpdump_data_count is not None:
|
||||||
print(f"Data frames captured (scapy): {scapy_data_count}")
|
|
||||||
print(f"Data frames captured (tcpdump): {tcpdump_data_count}")
|
|
||||||
if tcpdump_data_count > 0:
|
if tcpdump_data_count > 0:
|
||||||
ratio = scapy_data_count / tcpdump_data_count
|
ratio = scapy_data_count / tcpdump_data_count
|
||||||
print(f"Scapy capture ratio: {ratio:.1%} ({scapy_data_count}/{tcpdump_data_count})")
|
print(f"Data frames: {scapy_data_count} (scapy) vs {tcpdump_data_count} (tcpdump), ratio: {ratio:.1%}")
|
||||||
elif scapy_data_count > 0:
|
elif scapy_data_count > 0:
|
||||||
print(f"Note: tcpdump found 0 data frames while scapy found {scapy_data_count}")
|
print(f"Data frames: {scapy_data_count} (scapy) vs 0 (tcpdump) - tcpdump found 0 data frames")
|
||||||
else:
|
else:
|
||||||
print("Note: tcpdump counter unavailable (tcpdump not found or failed)")
|
print(f"Data frames: {scapy_data_count} (scapy) vs {tcpdump_data_count} (tcpdump)")
|
||||||
|
else:
|
||||||
|
print(f"Data frames: {scapy_data_count} (scapy) - tcpdump counter unavailable")
|
||||||
|
|
||||||
if total_count == 0:
|
if total_count == 0:
|
||||||
self._print_no_packets_message()
|
self._print_no_packets_message()
|
||||||
|
|
@ -598,7 +598,7 @@ class CaptureAnalyzer:
|
||||||
|
|
||||||
if subtype_counts:
|
if subtype_counts:
|
||||||
print(" Data frame subtypes:")
|
print(" Data frame subtypes:")
|
||||||
for subtype, count in sorted(subtype_counts.items()):
|
for subtype, count in sorted(subtype_counts.items(), key=lambda x: (1 if x[0] == 'unknown' else 0, x[0])):
|
||||||
subtype_name = self._get_data_subtype_name(subtype)
|
subtype_name = self._get_data_subtype_name(subtype)
|
||||||
print(f" Subtype {subtype} ({subtype_name}): {count} frame(s)")
|
print(f" Subtype {subtype} ({subtype_name}): {count} frame(s)")
|
||||||
|
|
||||||
|
|
@ -769,7 +769,7 @@ class PacketCapture:
|
||||||
ta_str = ta if ta else "N/A"
|
ta_str = ta if ta else "N/A"
|
||||||
plcp = "yes" if pkt.haslayer(RadioTap) else "no"
|
plcp = "yes" if pkt.haslayer(RadioTap) else "no"
|
||||||
timestamp = self.analyzer._format_timestamp(pkt)
|
timestamp = self.analyzer._format_timestamp(pkt)
|
||||||
print(f" Frame {i+1 if i > 0 else test_count}: time={timestamp}, RA={ra_str}, TA={ta_str}, PLCP={plcp}")
|
print(f" Frame {i+1}: time={timestamp}, RA={ra_str}, TA={ta_str}, PLCP={plcp}")
|
||||||
|
|
||||||
print(f"\nTest capture results:")
|
print(f"\nTest capture results:")
|
||||||
print(f" Packets captured: {test_count}")
|
print(f" Packets captured: {test_count}")
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue