本文介绍了Scapy 错误:没有模块名称 pcapy的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
下面给出的代码用于从提供的 IP 地址嗅探数据包.
The code given below is for sniffing a packet from the IP address provided.
from scapy.all import *
sniff(filter="tcp and host 192.168.0.90", count=10)
在运行此代码时,我得到的错误是:
On running this code the error I am getting is:
Traceback (most recent call last): File ".\sample.py", line 1, in <module>
from scapy.all import * File "C:\Python27\lib\site-packages\scapy\all.py", line 16, in <module>
from arch import * File "C:\Python27\lib\site-packages\scapy\arch\__init__.py", line 79, in <module>
from windows import * File "C:\Python27\lib\site-packages\scapy\arch\windows\__init__.py", line 23, in <module>
from scapy.arch import pcapdnet File "C:\Python27\lib\site-packages\scapy\arch\pcapdnet.py", line 30, in <module>
import pcapy as pcap ImportError: No module named pcapy
我哪里出错了?为此,我使用的是 Windows 7.
Where am I going wrong? I am using windows 7 for this.
推荐答案
try this to import For Ubuntu
try this to import For Ubuntu
$ sudo apt-get install python-pcapy
您也可以从源代码构建它:
You can also build it from source:
$ sudo pip install "http://corelabs.coresecurity.com/index.php?module=Wiki&action=attachment&type=tool&page=Pcapy&file=pcapy-0.10.8.tar.gz"
这里有很好的 Scapy 文档.http://www.secdev.org/projects/scapy/doc/installation.html
And here is good documentation of Scapy. http://www.secdev.org/projects/scapy/doc/installation.html
对于 Windows,您可以根据您的要求版本从以下链接下载并运行 setup.py 文件.
For Windows, you can download and run setup.py file from the below link as per your requirement version.
http://corelabs.coresecurity.com/index.php?module=Wiki&action=view&type=tool&name=Pcapy
http://breakingcode.wordpress.com/2012/07/16/quickpost-updated-impacketpcapy-installers-for-python-2-5-2-6-2-7/
这篇关于Scapy 错误:没有模块名称 pcapy的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!