Python3 - installing Scapy on an OS

I have installed the Scapy networking module . When I import scapy ( import scapy

) everything works fine. When I import everything from scapy ( from scapy.all import *

) it throws this error:

Traceback (most recent call last):
File "/Users/***/Downloads/test.py", line 5, in <module>
from scapy.all import *
File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/scapy/all.py", line 16, in <module>
from .arch import *
File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/scapy/arch/__init__.py", line 75, in <module>
from .bsd import *
File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/scapy/arch/bsd.py", line 12, in <module>
from .unix import *
File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/scapy/arch/unix.py", line 22, in <module>
from .pcapdnet import *
File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/scapy/arch/pcapdnet.py", line 22, in <module>
from .cdnet import *
File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/scapy/arch/cdnet.py", line 17, in <module>
raise OSError("Cannot find libdnet.so")
OSError: Cannot find libdnet.so

      

I learned in another post that we might need to load additional modules to make scapy fully functional. What exactly should be done? I tried using (port ** install) which didn't work because the port is no longer supported? If you have any idea how to get it to work in python3 I'll be proactive. Here's some more additional information:

python 3.4.3
mac os 10.10.4
scapy-python3==0.14

      

EDIT: Another interesting thing:

All operating systems except Linux must have libpcap installed to send and receive packages (not python modules - only C libraries). libdnet is recommended for sending packets, no libdnet packets will be sent to libpcap, which is limited. In addition, the netifaces module can be used for an alternative and possibly cleaner way of determining local addresses. Source: https://pypi.python.org/pypi/scapy-python3/0.11

Dnet only seems to work with version 2.7: https://pypi.python.org/pypi/dnet/1.12

+3


source to share


2 answers


You need to install libdnet. Not the python library (which doesn't work on python3 as you mentioned), but the library itself. There should be a library file libdnet.so somewhere on your system where python looks for libraries. Downloading the source and compiling libdnet should make it work:

wget http://libdnet.googlecode.com/files/libdnet-1.12.tgz
tar xfz libdnet-1.12.tgz
cd libdnet-1.12
./configure
make

      



It is also possible to use libpcap to send packets and not use libdnet, but I recommend trying libdnet first.

0


source


Now you can easily install Homebrew using the command:

brew install libdnet

      



after you've installed Homebrew.

+1


source







All Articles