Reputation: 85
Well, I am trying to write a starvation DHCP attack code through the following code.
I have tried pip install scapy
and also pip install --pre
but they do not work. I am running the program on windows. The problem is with from scapy.all import *
line:
import sys
import os
import logging
logging.getLogger("scapy.runtime").setLevel(logging.ERROR)
from scapy.all import *
...
Here is the error:
ModuleNotFoundError: No module named 'scapy'
What should I do?
Upvotes: 1
Views: 1383
Reputation: 179
This error means that you have not successfully installed scapy in a place that python is expecting it. I expect that you have not installed scapy successfully at all, based on installation methods you have tried.
I would recommend following the Windows specific scapy documentation found here: https://scapy.readthedocs.io/en/latest/installation.html#windows
pip install
is not supported for scapy on Windows.
See the relevant section below:
You need the following software in order to install Scapy on Windows:
Python: Python 2.7.X or 3.4+. After installation, add the Python installation directory and its Scripts subdirectory to your PATH. Depending on your Python version, the defaults would be C:\Python27 and C:\Python27\Scripts respectively.
Npcap: the latest version. Default values are recommended. Scapy will also work with Winpcap.
Scapy: latest development version from the Git repository. Unzip the archive, open a command prompt in that directory and run python setup.py install. Just download the files and run the setup program. Choosing the default installation options should be safe. (In the case of Npcap, Scapy will work with 802.11 option enabled. You might want to make sure that this is ticked when installing).
After all packages are installed, open a command prompt (cmd.exe) and run Scapy by typing scapy. If you have set the PATH correctly, this will find a little batch file in your C:\Python27\Scripts directory and instruct the Python interpreter to load Scapy.
Upvotes: 1