WiFi
PacketGen can handle wifi packets thanks to PacketGen::Header::Dot11
classes.
Create wifi packets
As PacketGen::Header::Dot11
is an abstract class it should not be used directly. Instead, PacketGen::Header::Dot11::Control
, PacketGen::Header::Dot11::Management
and PacketGen::Header::Dot11::Data
should be used.
Creation of protected frames is not supported yet.
Create control frames
Control frames may be created this way:
Create management frames
Management frames may be created this way:
Management frames are usually specialized. By example, you may want to create an AssociationRequest frame:
Management frames also may contain some elements (see IEEE 802.11 standard):
Create data frames
Data frames may be created this way (LLC and SNAP layers are needed):
Send wifi packets
To send a Dot11 packet, simply do:
RadioTap header is needed to send packets on the air.
Before sending a packet, you always should call PacketGen::Packet#calc
to automatically set lengths and checksums in packets. This is not done automatically to let you send malformed packets on "wire" for network test purpose.
Capture and parse wifi packets
Capturing and parsing Dot11 packets is supported by PacketGen.capture
, PacketGen.read
and PacketGen.parse
.
Captured packets may contain a header before Dot11 one: a PPI
or a RadioTap
, depending on your network interface's driver.
Capturing wifi packets
Parsing wifi packets in general
Parsing wifi packets is also supported from reading from a PCAP (or PCAP-ng) file, or from parsing a binary string.
Frame Control Sequence
FCS is the CRC of the Dot11 frame. By default, PacketGen, sets a FCS field in all Dot11 frames, and try to parse it when parsing or capturing.
But, some drivers remove FCS field when capturing, and/or do not support setting it. You may deactivate FCS in Dot11, for all packets:
See also
API documentation for PacketGen::Header::Dot11
Last updated