解决 scapy “NameError: global name 'wrpcap' is not defined” 错误
通过 scapy 编写发包脚本时遇到如下错误:
Traceback (most recent call last): File "attacker.py", line 62, inmain() File "attacker.py", line 59, in main sendpfast(pkt_list, pps=rate, iface=iface) File "/usr/lib/python2.7/dist-packages/scapy/sendrecv.py", line 289, in sendpfast wrpcap(f, x)NameError: global name 'wrpcap' is not defined
解决方法是打开 sendrecv.py
:
vim /usr/lib/python2.7/dist-packages/scapy/sendrecv.py
导入以下模块:
from utils import warning, get_temp_file, PcapReader, wrpcap
2018.11