secdev / scapy

Scapy: the Python-based interactive packet manipulation program & library.
https://scapy.net
GNU General Public License v2.0
10.67k stars 2.02k forks source link

the `sendp` function didn't work when send packets in channel 12 and 13 in python3 but work well in python2(I am usingpython3.7.7) #2740

Closed Yao-T closed 4 years ago

Yao-T commented 4 years ago

Reproduce steps:

ifconfig wlan0 down
iw dev set wlan0 set type monitor
ifconfig wlan0 up
iw dev set wlan0 set channel 12
PAD_PKT = Padding("\x00"*1000)

class Dot11Packet(object):
    def __init__(self, addr1, addr2, addr3, subtyp=0):
        self.rt = RadioTap(present='Flags+Rate+Channel+dBm_AntSignal+Antenna')
        self.dot11hdr = Dot11(type="Data", subtype=subtyp, addr1=addr1, addr2=addr2, addr3=addr3)
        self.data = self.rt / self.dot11hdr  # / Dot11QoS()
        self.recv_mac = addr1
        self.trans_mac = addr2
        self.dst_mac = addr2

    def __str__(self):
        return str(self.data[RadioTap].payload)  # RadioTap information is only useful while sending (in monitor mode).

def data_pkt(subtype=0):
    """
    to send the data packets
    @param iface: the iface to send packets
    @param count: how many packets to be sent
    @param inter: the internal of send packets
    @return:
    """
    pkt = Dot11Packet(addr1=ADDR1, addr2=ADDR2, addr3=ADDR3, subtyp=subtype)
    # pkt = pkt.data / "DATA PKTS"
    arp_packet = ARP()
    arp = \
        LLC(dsap=0xaa, ssap=0xaa, ctrl=0x03) \
        / SNAP(OUI=0x000000, code=0x0806) \
        / arp_packet
    pkt = pkt.data / arp
    return pkt/PAD_PKT

if __name__ == '__main__':
    pkt = data_pkt()
    sendp(pkt, iface="wlan0", verbose=False, inter=0.01, count=1000)
gpotter2 commented 4 years ago

This sounds super strange: we aren't really doing anything different in Python 2. (understand: the issue is likely in your Python install)

Please fill the template and make sure that you are using a modern version of Scapy with both Python versions; it sounds to me that you have a different install for both:

python3 -c "import scapy; print(scapy.__version__)"
python2 -c "import scapy; print(scapy.__version__)"
gpotter2 commented 4 years ago

Closing for inactivity