Scapy install issues. Nothing seems to actually be

2020-05-23 08:58发布

问题:

I have an apple computer running Leopard with python 2.6. I downloaded the latest version of scapy and ran "python setup.py install". All went according to plan. Now, when I try to run it in interactive mode by just typing "scapy", it throws a bunch of errors. What gives!

Just in case, here is the FULL error message..

INFO: Can't import python gnuplot wrapper . Won't be able to plot.
INFO: Can't import PyX. Won't be able to use psdump() or pdfdump().
ERROR: Unable to import pcap module: No module named pcap/No module named pcapy
ERROR: Unable to import dnet module: No module named dnet
Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/runpy.py", line 122, in _run_module_as_main
    "__main__", fname, loader, pkg_name)
  File "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/runpy.py", line 34, in _run_code
    exec code in run_globals
  File "/Users/owner1/Downloads/scapy-2.1.0/scapy/__init__.py", line 10, in <module>
    interact()
  File "scapy/main.py", line 245, in interact
    scapy_builtins = __import__("all",globals(),locals(),".").__dict__
  File "scapy/all.py", line 25, in <module>
    from route6 import *
  File "scapy/route6.py", line 264, in <module>
    conf.route6 = Route6()
  File "scapy/route6.py", line 26, in __init__
    self.resync()
  File "scapy/route6.py", line 39, in resync
    self.routes = read_routes6()
  File "scapy/arch/unix.py", line 147, in read_routes6
    lifaddr = in6_getifaddr()
  File "scapy/arch/unix.py", line 123, in in6_getifaddr
    i = dnet.intf()
NameError: global name 'dnet' is not defined

回答1:

Follow these instructions from scapy website. There are dependencies that you must resolve before doing the install. It worked like a charm for me on a Windows machine.

http://www.secdev.org/projects/scapy/doc/installation.html#mac-os-x



回答2:

I've also had lots of issues getting Scapy and its dependencies properly installed on my Mac, finally I found Homebrew Python GitHub page https://github.com/Homebrew/homebrew-python it contains lots of helpful/useful brew formula including one for Scapy that worked like a charm for me.

brew tap Homebrew/python
brew install scapy

I also had an issue with my pcapy which was solved by another formula in the repo for pypcap, so same procedure.

brew install pypcap


回答3:

I have collected all the libraries needed for network programming in Python for Windows and made a single integrated installer. Its on Google Code. Just extract and run the installer after reading the installation file, installs all the dependencies needed for running Scapy on Py2.6.



回答4:

Install libdnet:http://libdnet.sourceforge.net/ and python-libpcat: http://sourceforge.net/projects/pylibpcap/

For libdent:

CFLAGS='-arch i386 -arch x86_64' ./configure --prefix=/usr
archargs='-arch i386 -arch x86_64' make
sudo make install
cd python
sudo python setup.py install


回答5:

I was able to get this working by #commenting out the route6 import statment in all.py within the scapy mod directory.

After that, I was able to bring up the interactive scapy prompt.

So the real solution to this issue is to make sure you have a compatible route6 mod.



回答6:

MAC install follow the instructions here in case if you want to install it in a virtualenv by first going into the virtualenv and then just using python setup.py install instead of sudo.