Python Scapy 错误:没有模块名称 pcapy

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/21698894/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-18 23:26:18  来源:igfitidea点击:

Scapy error: no module names pcapy

pythonscapy

提问by Prakhar Mohan Srivastava

The code given below is for sniffing a packet from the IP address provided.

下面给出的代码用于从提供的 IP 地址嗅探数据包。

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

Where am I going wrong? I am using windows 7 for this.

我哪里错了?为此,我正在使用 Windows 7。

采纳答案by Bhavesh Odedra

try this to import For Ubuntu

试试这个导入 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"

And here is good documentation of Scapy. http://www.secdev.org/projects/scapy/doc/installation.html

这是 Scapy 的良好文档。http://www.secdev.org/projects/scapy/doc/installation.html

For Windows,you can download and run setup.pyfile from the below link as per your requirement version.

对于Windows,您可以根据您的要求版本从以下链接下载并运行setup.py文件。

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/