Add a script for seeing what radiotap can tell us.
This commit is contained in:
parent
ec2bbc43a4
commit
1dc679a04d
1 changed files with 61 additions and 0 deletions
61
panda_truth_probe.py
Normal file
61
panda_truth_probe.py
Normal file
|
@ -0,0 +1,61 @@
|
||||||
|
#!/usr/bin/env python3
|
||||||
|
import pyshark
|
||||||
|
import argparse
|
||||||
|
|
||||||
|
def analyze_radiotap_info(pcapng_path, limit=100):
|
||||||
|
cap = pyshark.FileCapture(
|
||||||
|
pcapng_path,
|
||||||
|
display_filter='radiotap.dbm_antsignal',
|
||||||
|
use_json=True,
|
||||||
|
include_raw=False,
|
||||||
|
keep_packets=False
|
||||||
|
)
|
||||||
|
|
||||||
|
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}")
|
||||||
|
continue
|
||||||
|
|
||||||
|
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 __name__ == '__main__':
|
||||||
|
parser = argparse.ArgumentParser()
|
||||||
|
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')
|
||||||
|
args = parser.parse_args()
|
||||||
|
|
||||||
|
analyze_radiotap_info(args.pcapng, args.limit)
|
Loading…
Add table
Add a link
Reference in a new issue