Search code examples
pythonmacosscapy

'ImportError: No module named dumbnet' when trying to run a script that leverages scapy on OS X


So, I am trying to learn about the scapy library in Python and trying to run a script that uses scapy. The script imports the module with:

from scapy.all import *

I saw this and of course installed scapy with:

pip install scapy

Next, I got the following import error:

ImportError: No module named pcapy

So, then I decided to install pcapy with pip install pcapy. It installed fine but now I am getting the import error of:

ImportError: No module named dumbnet

I can't find a module called dumbnet. Anybody know whats going on here?

This is the first time I am messing around scapy and am using a Mac with Python 2.7 install in an activated virtual environment.

Edit1:

Here is the full error:

Traceback (most recent call last):
  File "syn_test.py", line 4, in <module>
    from scapy.all import * # The One and Only Scapy
  File "/Users/dasComputer/venv_mac/lib/python2.7/site-packages/scapy/all.py", line 16, in <module>
    from scapy.arch import *
  File "/Users/dasComputer/venv_mac/lib/python2.7/site-packages/scapy/arch/__init__.py", line 79, in <module>
    from scapy.arch.pcapdnet import *
  File "/Users/dasComputer/venv_mac/lib/python2.7/site-packages/scapy/arch/pcapdnet.py", line 471, in <module>
    import dumbnet as dnet
ImportError: No module named dumbnet

Solution

  • dumbnet is also known as libdnet. Source can be found at https://github.com/dugsong/libdnet. You can run the following commands in Terminal and scapy should work.

    cd
    git clone https://github.com/dugsong/libdnet.git
    cd libdnet
    ./configure && make
    cd python
    python setup.py install