Scapy Dot11 not found

Asked by At

I can't seem to access Dot11. My setup is as follows:

  1. Kali Linux VM image
  2. Installed Scapy via: pip install git+https://github.com/secdev/scapy
  3. Pycharm running python 3.6

The script:

from scapy.all import *

def packethandler(pkt):
    if pkt.haslayer(Dot11):
        print("hello")

sniff(iface="wlan0mon",prn=packethandler,store=0,monitor=True)

The Dot11 is flagged and is not found. However, I am able to do the following:

sniff(iface="wlan0mon", prn=lambda p: p.summary(), store=0)

which in turn actually works and finds 802.11 packets. Can anyone help me out?

1 Answers

1
jfleach On

Try to avoid using wildcard imports, try something like this:

from scapy.layers.dot11 import Dot11
from scapy.sendrecv import sniff

def packethandler(pkt):
    if pkt.haslayer(Dot11):
        print("hello")

sniff(iface="wlan0mon",prn=packethandler,store=0,monitor=True)