Install Scapy on Mac: "ImportError: no module named pcapy"

I am trying to run a python script that includes scapy, but I cannot get it to work. I keep getting this error

ImportError: no module named pcapy

script I'm trying to run:

from scapy.all import *

def arp_display(pkt):
  if pkt[ARP].op == 1: #who-has (request)
    if pkt[ARP].psrc == '0.0.0.0': # ARP Probe
      print "ARP Probe from: " + pkt[ARP].hwsrc

print sniff(prn=arp_display, filter="arp", store=0, count=10)

I installed Xcode, XQuartz, Python and Scapy using macports

Please let me know what I am missing! #noob

+4
source share
2 answers

Try installing libpcap and its Python shell from the source, as indicated here , although the latest version is 0.6.4, not 0.6.2:

$ wget http://dfn.dl.sourceforge.net/sourceforge/pylibpcap/pylibpcap-0.6.4.tar.gz
$ tar xfz pylibpcap-0.6.4.tar.gz
$ cd pylibpcap-0.6.4
$ sudo python setup.py install
+4
source

I had the same problem. I solved this by following these steps:

1.)

sudo pip install --user pcapy

2.)

python

3.)

import pcapy

.

,

+5

Source: https://habr.com/ru/post/1610119/


All Articles