0

I am interested in getting the RSSI values if APs using a scapy sniffer. I am using sig_str = -(256-ord(packet.notdecoded[-4:-3])) to get the RSSI values. However, I am getting -256 for all the APs. The notdecoded part is then 0. Could someone please help me figure this one out?

PS: I have already referenced this relevant post. https://stackoverflow.com/a/34118234/4804221

TIA!

Community
  • 1
  • 1
KDK
  • 55
  • 1
  • 10

1 Answers1

0

Prerequisite

Assuming the interface is in monitor mode, and correct channel assigned. Following example configures iface=wlan0 to monitor mode and listens to channel=6

$ sudo ip link set wlan0 down
$ sudo iw dev wlan0 set type monitor
$ sudo ip link set wlan0 up
$ sudo iw dev wlan0 set channel 6

Python3

RSSI from a packet can be earned by dBm_AntSignal if RadioTap header is correctly sniffed together.

from scapy.all import RadioTap
from scapy.all import sniff

# sniff a packet from the interface
pkt = sniff(iface="wlan0", count=1)
pkt = pkt[0]

# getting the RSSI
radiotap = pkt.getlayer(RadioTap)
rssi = radiotap.dBm_AntSignal
print("RSSI={}".format(rssi)) # RSSI=-84

Python2

Seems like dBm_AntSignal is not working on python2 scapy, following example will work.

extra = pkt.notdecoded
rssi = -(256-ord(extra[-4:-3]))

Hope this helps.

yananet
  • 101
  • 6