Reputation: 1061
I'm trying to decode the signal value (SSI) in the wireless management frame from a scapy sniff function. I have searched and tried a few answeres but with no success. Here's what I have so far. Trying to decode the hex string.
Code:
from scapy.all import *
def packet_handler(pkt):
if pkt.haslayer(Dot11) and pkt.type == 0:
sig = pkt[RadioTap].notdecoded.decode("hex")
print sig
sniff(iface="wlan0mon", prn=packet_handler)
Packet Sample:
###[ RadioTap dummy ]###
version = 0
pad = 0
len = 36
present = TSFT+Flags+Rate+Channel+dBm_AntSignal+b14+b29+Ext
notdecoded= ' \x08\x00\x00\x00\x00\x00\x00\xf4\x82\xc2\xc6\x01\x00\x00\x00\x10\x02\x99\t\xa0\x00\xb1\x00\x00\x00\xb1\x00'
I'm catching the 'notdecoded' field's value and trying to decode it through straight python.
Error:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python2.7/dist-packages/scapy/sendrecv.py", line 600, in sniff
r = prn(p)
File "<stdin>", line 4, in packet_handler
File "/usr/lib/python2.7/encodings/hex_codec.py", line 42, in hex_decode
output = binascii.a2b_hex(input)
TypeError: Non-hexadecimal digit found
Upvotes: 0
Views: 1572
Reputation: 11
Update to the latest version of scapy; these are being properly decoded in the update (I'm using 2.4.0 dev263).
Update scapy:
git clone https://github.com/secdev/scapy
cd scapy
./run_scapy
Or
git clone https://github.com/secdev/scapy
cd scapy
python setup.py install
Upvotes: 1