gpt4 book ai didi

python - Ubuntu 14.04 上 scapy 的导入错误

转载 作者:行者123 更新时间:2023-12-04 18:34:17 31 4
gpt4 key购买 nike

我有兴趣在我的 python 代码中使用 scapy 作为包。
我按照说明安装它,这是我的 python 代码(实际上这是从另一个网站获取的代码):

#!/usr/bin/python3.4
from scapy import *


ap_list = []

def PacketHandler(pkt) :
if pkt.haslayer(Dot11) :
if pkt.type == 0 and pkt.subtype == 8 :
if pkt.addr2 not in ap_list :
ap_list.append(pkt.addr2)
print("AP MAC: {} with SSID: {} ".format(pkt.addr2, pkt.info))


sniff(iface="mon0", prn = PacketHandler)

我收到以下错误:
“ImportError:没有名为‘scapy’的模块”
不过,在我的情况下,我在之前的帖子中看到了答案:
- Scapy 已经安装:
armand@ACPC:~$ sudo apt-get install python-scapy
[sudo] password for armand:
Reading package lists... Done
Building dependency tree
Reading state information... Done
python-scapy is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 169 not upgraded.

- 目录/usr/share/pyshared 包含 scapy:
armand@ACPC:~$ cd /usr/share/pyshared/
armand@ACPC:/usr/share/pyshared$ ls
scapy scapy-2.2.0.egg-info
armand@ACPC:/usr/share/pyshared$

- Scapy 在解释器上运行:
armand@ACPC:/usr/share/pyshared$ scapy
INFO: Can't import python gnuplot wrapper . Won't be able to plot.
INFO: Can't import PyX. Won't be able to use psdump() or pdfdump().
WARNING: No route found for IPv6 destination :: (no default route?)
Welcome to Scapy (2.3.1)
>>>

当我将 scapy 作为库导入时可能存在问题,但我不知道它是什么。我在 Ubuntu14.04 上运行 python3.4。
预先感谢您的帮助 !

最佳答案

官方的 scapy 项目仅适用于 Python 2.x。这是一个 Python 3 端口:http://github.com/phaethon/scapy

关于python - Ubuntu 14.04 上 scapy 的导入错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33786769/

31 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com