probemon icon indicating copy to clipboard operation
probemon copied to clipboard

wrong RSSI value

Open solsticedhiver opened this issue 8 years ago • 8 comments

When I use the -r or --rssi switch I got big negative value that are non sense.

I found out that I must replace the line 56 with this one:

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

to get the correct value

I don't know if it's universal.

solsticedhiver avatar Oct 03 '17 10:10 solsticedhiver

Hi, I am also getting the same value. Did you solve the issue?

rpandey91 avatar Jan 24 '18 05:01 rpandey91

YES. I have shown the fix above. it's line 56

solsticedhiver avatar Jan 25 '18 00:01 solsticedhiver

A more general fix is to use the offical radiotap library to parse the RSSI value

Something like this:

from radiotap import radiotap_parse
offset, headers = radiotap_parse(str(packet))
rssi = headers['dbm_antsignal']

This adds a dependancy but it is a more robust fix.

solsticedhiver avatar Feb 07 '18 22:02 solsticedhiver

So before I make the fix I am unable to run Probemon. After I make: rssi_val = -(256-ord(packet.notdecoded[-2:-1])) it works, but the rssi value is always -256. How do I fix?

shepardac avatar Jun 23 '18 18:06 shepardac

I am having the same issue. If we use the above where would this get placed in the coding?

bmrquad avatar Jul 10 '18 20:07 bmrquad

A more general fix is to use the offical radiotap library to parse the RSSI value

Something like this:

from radiotap import radiotap_parse
offset, headers = radiotap_parse(str(packet))
rssi = headers['dbm_antsignal']

This adds a dependancy but it is a more robust fix.

this worked for me.

rub0t avatar Oct 26 '18 03:10 rub0t

So instead of importing a new dependancy with python-radiotap, one can use the following function (this is a stripped down version of the python-radiotap parsing module)

def parse_rssi(packet):
    # parse dbm_antsignal from radiotap header
    # borrowed from python-radiotap module
    radiotap_header_fmt = '<BBHI'
    radiotap_header_len = struct.calcsize(radiotap_header_fmt)
    version, pad, radiotap_len, present = struct.unpack_from(radiotap_header_fmt, packet)

    start = radiotap_header_len
    bits = [int(b) for b in bin(present)[2:].rjust(32, '0')]
    bits.reverse()
    if bits[5] == 0:
        return 0

    while present & (1 << 31):
        present, = struct.unpack_from('<I', packet, start)
        start += 4
    offset = start
    if bits[0] == 1:
        offset = (offset + 8 -1) & ~(8-1)
        offset += 8
    if bits[1] == 1:
        offset += 1
    if bits[2] == 1:
        offset += 1
    if bits[3] == 1:
        offset = (offset + 2 -1) & ~(2-1)
        offset += 4
    if bits[4] == 1:
        offset += 2
    dbm_antsignal, = struct.unpack_from('<b', packet, offset)
    return dbm_antsignal

So, for example replace line 56 with

    rssi_val = parse_rssi(buffer(str(packet)))

You will need to import struct module

solsticedhiver avatar Jan 15 '19 18:01 solsticedhiver

With latest scapy you can just use: rssi_val = packet.dBm_AntSignal

WolfspiritM avatar Jan 27 '19 18:01 WolfspiritM