PyCharm: Unresolved reference with Scapy
This is a PyCharm issue. Scapy uses dynamic loading (using importlib
) to load many modules / custom modules, that pycharm does not detect. This allows the users to select which layers they want to have loaded.
The workaround is to import whatever you need from their related scapy file, without using all
. It is cleaner but longer to do. Or you can use "add an exception" in your IDE, if you’re not looking for something clean.
Here are a few useful modules
-
scapy.layers.inet
where you can get IP, TCP.. scapy.layers.inet6
scapy.layers.dns
-
scapy.sendrecv
has srp, sr, sr1, sendp, send... -
scapy.supersocket
to directly access scapy’s sockets -
scapy.layers.l2
which has Ether, ARP.. -
scapy.layers.dot11
for 802.11 stuff -
scapy.utils
forwrpcap
,rdpcap
... -
scapy.config
for theconf
object (which has properties such asconf.route
orconf.route6
)
What I advise to do is to open the Scapy shell (or import from scapy.all import *
in a console) and check from which module a layer/function is by using help(...)
. You can also check out the online API reference (it has a search bar) over here
Had the same issue, try importing this way:
from scapy.layers.inet import IP, UDP, wrpcap, Ether
it worked for me.