Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for 802.11 Action frames #660

Open
FeldrinH opened this issue Dec 15, 2023 · 2 comments
Open

Support for 802.11 Action frames #660

FeldrinH opened this issue Dec 15, 2023 · 2 comments

Comments

@FeldrinH
Copy link

FeldrinH commented Dec 15, 2023

The IEEE80211 packet decoder has some support for Action frames, but in many cases it throws an UnpackError and refuses to parse the entire packet if it finds an Action frame it doesn't recognize.

It would be nice if all common Action frames were supported. It would also be nice if instead of throwing an error it would keep the unrecognized Action frame as raw bytes, so the user could decode it themselves.

Additional context
A pcap file with some 802.11 Action frames that dpkt currently can't decode: odid_wifi_sample.zip

@kbandla
Copy link
Owner

kbandla commented Dec 18, 2023

Hi @FeldrinH. Can you share the script you used to try to parse the packets?

@FeldrinH
Copy link
Author

FeldrinH commented Dec 18, 2023

Sure. The actual script included extra logic for other linktypes, but the relevant part is this:

import sys
from dpkt import pcap, pcapng
from dpkt.radiotap import Radiotap

if __name__ == '__main__':
    file = sys.argv[1]
    print(f"Reading pcap from {file}")
    with open(file, mode='rb') as f:
        if file.endswith('.pcapng'):
            reader = pcapng.Reader(f)
        else:
            reader = pcap.Reader(f)

        assert reader.datalink() == pcap.DLT_IEEE802_11_RADIO

        count = 0
        for _, buffer in reader:
            count += 1
            packet = Radiotap(buffer)
            packet.pprint()
    print(f"Read {count} packets")

Tested with dpkt 1.9.8, produces dpkt.dpkt.UnpackError: KeyError: category=4 code=9.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants