I'm interested in using scapy as a package in my python code. I followed the instructions to install it, and here is my python code (actually this is a code taken from another website):
#!/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)
I get the following error: "ImportError: No module named 'scapy' " I saw on the previous posts the answers, though, in my case: - Scapy is already installed:
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.
- The directory /usr/share/pyshared contains 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 runs on the interpreter:
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)
>>>
There probably is a problem when I import scapy as a library but I don't what it is. I'm running python3.4 on Ubuntu14.04. Thank you in advance for your help !
The official scapy project only work with Python 2.x. Here's a Python 3 port: http://github.com/phaethon/scapy
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.