繁体   English   中英

在Ubuntu 14.04上的Scapy导入错误

[英]Import error for scapy on Ubuntu 14.04

我有兴趣在我的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项目仅适用于Python2.x。 这是一个Python 3端口: http : //github.com/phaethon/scapy

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM