1
我尝试从在线课程运行python代码以创建原始网络数据包并通过scapy在Debian 9上使用python 3.4.2发送到网络,但是我得到了错误信息,如下所示:获取“NameError:name'IP'未定义”错误消息
当我看着代码NameError: name 'IP' is not defined
:
#!/usr/bin/python
#for python 3 , must install scapy for python3 first by type command "pip3 install scapy-python3"
import scapy.all
frame = scapy.all.Ether(dst="15:16:89:fa:dd:09")/IP(dst="9.16.5.4")/TCP()/"This is my payload"
有下“IP”和“TCP”方法的红线,然后它告诉那些2方法有Unresolved reference
我试图改变如何导入Scapy的库
from
import scapy.all
到
from scapy.all import *
但问题没有得到解决。我有什么问题?
当您使用scapy import *'时,这种行为是否会持续存在? – Clay
@Clay yes和它给了我另一个错误,即“AttributeError:'builtin_function_or_method'对象没有属性'以太'” – thsecmaniac
尝试从scapy.all导入*并在代码Ether(dst =“15:16:89:fa :dd:09“)/ IP(dst =”9.16.5.4“)/ TCP()/”这是我的有效载荷“ – galaxyan