简体   繁体   中英

Unable to transmit/inject 802.11 packets using Scapy

I'm trying to transmit a data frame (using scapy in ubuntu 18.04) between my desktop and laptop. I would like the MSDU to just be some raw data and not an upper layer frame. For whatever reason I am unable to detect transmitted packets between the devices.

Both devices are set in monitor mode and are connected to the same frequency/channel. For example, my desktop has wireless interface wlp4s0 which I set up as follows:

sudo ifconfig wlp4s0 down
sudo iwconfig wlp4s0 mode monitor
sudo ifconfig wlp4s0 up
sudo iwconfig wlp4s0 channel n

When I check iw dev or iwconfig I can see that both wireless interfaces are in monitor mode and at the same frequency with a non-zero tx-power.

I have no problems sniffing the channel using scapy with the following code:

sniff(iface = "wlp4s0", prn = output)

Where prn just prints out the summary of any packet.

When I try to transmit I use the following code on one device:

    header = Dot11(
        addr1 = "00:16:ea:12:34:56",
        addr2 = "00:16:ea:12:34:56",
        addr3 = "ff:ff:ff:ff:ff:ff",
        type = 2,
        subtype = 0,
        FCfield = 0)

    data = "testtesttesttest"
    packet = header / data
    sendp(data, iface= "wlp4s0", loop = 1, inter = 0.100)

Despite the transmitting device stating the packet has been transmitted, the other devices cannot see any of the packets while sniffing the channel. Similarly, while using 'ifconfig' the tx_count for the interface is not increasing.

I've tried switching roles on both devices, but have also had no luck.

Any help would be greatly appreciated, thanks!

It seems that you are sending packets to yourself. addr1 is for the receiver. addr2 is for the sender.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM