Scapy - retrieving RSSI from WiFi packets

空扰寡人 提交于 2019-11-30 14:40:41
binary koala

Here is a valuable scapy extension that improves scapy.layers.dot11.Packet's parsing of present not decoded fields.

https://github.com/ivanlei/airodump-iv/blob/master/airoiv/scapy_ex.py

Just use:

import scapy_ex

And:

packet.show()

It'll look like this:

###[ 802.11 RadioTap ]###
  version   = 0
  pad       = 0
  RadioTap_len= 18
  present   = Flags+Rate+Channel+dBm_AntSignal+Antenna+b14
  Flags     = 0
  Rate      = 2
  Channel   = 1
  Channel_flags= 160
  dBm_AntSignal= -87
  Antenna   = 1
  RX_Flags  = 0
kaczor1984

To summarize:

  • signal strength was not visible because something was wrong in the way that 'monitor mode' was set (not all headers were passed/parsed by sniffers). This monitor interface was created by hostapd.

  • now I'm setting monitor mode on interface with airmon-ng - tcpdump, scapy show theese extra headers.

Edited: use scapy 2.4.1+ (or github dev version). Most recent versions now correctly decode the « notdecoded » part

Marcelo Beraldi

For some reason the packet structure has changed. Now dBm_AntSignal is the first element in notdecoded.

I am not 100% sure of this solution but I used sig_str = -(256 - ord(packet.notdecoded[-2:-1])) to reach first element and I get values that seems to be dBm_AntSignal.

I am using OpenWRT in a TP-Link MR3020 with extroot and Edward Keeble Passive Wifi Monitoring project with some modifications.

I use scapy_ex.py and I had this information:

802.11 RadioTap

  version   = 0

  pad       = 0

  RadioTap_len= 36

  present   = dBm_AntSignal+Lock_Quality+b22+b24+b25+b26+b27+b29

  dBm_AntSignal= 32

  Lock_Quality= 8

If someone still has the same issue, I think I have found the solution:

I believe this is the right cut for the RSSI value:

sig_str = -(256-ord(packet.notdecoded[-3:-2]))

and this one is for the noise level:

noise_str = -(256-ord(packet.notdecoded[-2:-1]))

The fact that it says "RadioTap" suggests that the device may supply Radiotap headers, not Prism headers, even though it has a Prism chipset. The p54 driver appears to be a "SoftMAC driver", in which case it'll probably supply Radiotap headers; are you using the p54 driver or the older prism54 driver?

I have similar problem, I set up the monitor mode with airmon-ng and I can see the dBm level in tcpdump but whenever I try the sig_str = -(256-ord(packet.notdecoded[-4:-3])) I get -256 because the returned value from notdecoded in 0. Packet structure looks like this.

 version   = 0
 pad       = 0
 len       = 36
 present   = TSFT+Flags+Rate+Channel+dBm_AntSignal+b14+b29+Ext
 notdecoded= ' \x08\x00\x00\x00\x00\x00\x00\x1f\x02\xed\x07\x05 
 .......
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!