i am trying to execute a python code in windows... the code containds the following lines:
from scapy import *
import random
import socket
import dns.query
but wen i compile it from command line it gives the following error:
C:\Python25 > attack.py
Traceback <most recent call last>:
File "C:\Python25\attack.py", line 4 , in <module>
import dns.query
ImportError: No module named dns.query
what could be the error?? how can i solve this?? is it due to the path or because the dns.query module is not compiling
This means that you do not have dnspython install.
There are two ways to install dnspython :
1.Good way:
To install any module, easiest way is to first install setup tools. Setup tools is something similar to "apt-get" for ubuntu. where you say "easy_install " and it will get it and install it. To install setuptools download the source from https://pypi.python.org/pypi/setuptools Now exctract them. Inside the extracted directory will be a file setup.py. run python setup.py install
This will install setup tools in your system.
you will be able to see a executable c:\python2x\Scripts\easy_install.exe (2x is the version of python eg 26, 27 etc)
Now to install dnspython run
c:\python2x\Scripts\easy_install.exe dnspython
This should solve your problem, and now your script should run normally.
You can also put c:\python2x\Scripts in windows PATH so that you do not have to put the whole path every time you want to install a module.
2.Bad way :
Although this method might not work if the some modules dnspython depends on are not available.
Download the sources of dnspython from http://www.dnspython.org/kits/1.10.0/ and extract it. now go to the extracted folder and run python setup.py install