diff --git a/panda_truth_probe.py b/panda_truth_probe.py index 7433b61..b33af8c 100755 --- a/panda_truth_probe.py +++ b/panda_truth_probe.py @@ -5,57 +5,79 @@ import argparse def analyze_radiotap_info(pcapng_path, limit=100): cap = pyshark.FileCapture( pcapng_path, - display_filter='radiotap.dbm_antsignal', + display_filter='radiotap', use_json=True, include_raw=False, keep_packets=False ) + print(f"\nAnalyzing up to {limit} packets for radiotap metadata...\n") + count = 0 - valid_entries = 0 - - print(f"\nAnalyzing up to {limit} packets for signal/noise info...\n") - for packet in cap: - try: - if not hasattr(packet, 'radiotap'): - continue - - signal = getattr(packet.radiotap, 'dbm_antsignal', None) - noise = getattr(packet.radiotap, 'dbm_antnoise', None) - - print(f"Packet #{count + 1}") - print(f" Signal: {signal} dBm") - print(f" Noise: {noise} dBm") - - if signal is not None and noise is not None: - try: - snr = int(signal) - int(noise) - print(f" SNR: {snr} dB") - except ValueError: - print(" SNR: [could not compute]") - - print("") - valid_entries += 1 - count += 1 - if count >= limit: - break - - except Exception as e: - print(f" [!] Error reading packet: {e}") + if not hasattr(packet, 'radiotap'): continue + print(f"Packet #{count + 1}") + + # Grab what you can from radiotap + signal = getattr(packet.radiotap, 'dbm_antsignal', None) + noise = getattr(packet.radiotap, 'dbm_antnoise', None) + channel = getattr(packet.radiotap, 'channel', None) + rate = getattr(packet.radiotap, 'rate', None) + antenna = getattr(packet.radiotap, 'antenna', None) + flags = getattr(packet.radiotap, 'flags', None) + + if signal is not None: + print(f" Signal Strength: {signal} dBm") + else: + print(" Signal Strength: [unavailable]") + + if noise is not None: + print(f" Noise Level: {noise} dBm") + else: + print(" Noise Level: [missing or fake]") + + if signal and noise: + try: + snr = int(signal) - int(noise) + print(f" Estimated SNR: {snr} dB") + except ValueError: + print(" Estimated SNR: [could not compute]") + else: + print(" Estimated SNR: [incomplete data]") + + if channel: + print(f" Channel/Frequency: {channel}") + else: + print(" Channel/Frequency: [unavailable]") + + if rate: + print(f" Data Rate: {rate} Mbps") + else: + print(" Data Rate: [unavailable]") + + if antenna: + print(f" Antenna Index: {antenna}") + if flags: + print(f" Radiotap Flags: {flags}") + + print("-" * 50) + count += 1 + if count >= limit: + break + cap.close() - if valid_entries == 0: - print("No usable radiotap signal/noise data found. Your dongle may be a liar.") - else: - print(f"Analyzed {valid_entries} packets with radiotap data.\n") + if count == 0: + print("No usable radiotap packets found. Either the capture is cursed or your Panda is just decorative.") + + print(f"\nFinished analyzing {count} packet(s). Radiotap field spelunking complete.\n") if __name__ == '__main__': - parser = argparse.ArgumentParser() + parser = argparse.ArgumentParser(description="Panda Truth Probe: Radiotap Field Dump") parser.add_argument('--pcapng', required=True, help='Path to your .pcapng file') - parser.add_argument('--limit', type=int, default=100, help='Max number of packets to analyze') + parser.add_argument('--limit', type=int, default=50, help='Max number of packets to analyze') args = parser.parse_args() analyze_radiotap_info(args.pcapng, args.limit)