Craft raw wifi packet
<p>I'd like to craft single wifi packets, getting the raw binary data just before they are converted to a waveform and transmitted. As I understand it, this should be at the data link layer, and include all the headers (sync bits, CRC, etc) and the data itself. Is there a way to do this (preferably with Python)? I've looked into scapy, Wireshark, etc but I can't tell if or how they can get me what I need.</p>

<p>You can dump all packet via monitor mode.<br>
For example, this code sniffing all data packets from mon0 interface:</p>

<pre><code>from scapy.all import *

def handler(pkt):
    if pkt.haslayer(Dot11):
    if pkt.type == 2:
            pkt.show()

sniff(iface="mon0", prn=handler)
</code></pre>

python wifi packet