Quantcast
Channel: Scapy installation fails on osx with dnet import error - Stack Overflow
Viewing all articles
Browse latest Browse all 6

Scapy installation fails on osx with dnet import error

$
0
0

Having trouble installing Scapy and it's required dependancies. I have spent some time Googling for a solution but all 'solutions' seem to affect older versions of Python, or simply do not work.

Script:

#!/usr/bin/pythonimport threadingimport Queueimport timefrom scapy.all import *class WorkerThread(threading.Thread) :    def __init__(self, queue, tid) :        threading.Thread.__init__(self)        self.queue = queue        self.tid = tid        print 'Worker: %d' %self.tid    def run(self) :        total_ports = 0        while True :            port = 0            try :                port = self.queue.get(timeout=1)            except Queue.Empty :                print 'Worker %d exiting. %d ports scanned'  %(self.tid, total_ports)                return                #Scanning begins            ip = sys.argv[1]            response = sr1(IP(dst=ip)/TCP(dport=port, flags='S'), verbose=False, timeout=.2)            if response :                if response[TCP].flags == 18 :                    print 'ThreadID: %d: Got port no. %d status: OPEN' %(self.tid, port)                self.queue.task_done()                total_ports += 1queue = Queue.Queue()threads = []for i in range(1, 10) :    print 'Creating WorkerThread : %d' %i    worker = WorkerThread(queue, i)    worker.setDaemon(True)    worker.start()    threads.append(worker)    print 'WorkerThread %d created' %ifor j in range(1, 100) :    queue.put(j)queue.join()for item in threads :    item.join()print 'Scanning complete'

Python version is 2.7.5 and path to Python verified.

which python/usr/bin/python

When script is executed I am getting the following error:

./multi-threaded-scanner.pyTraceback (most recent call last):  File "./multi-threaded-scanner.py", line 6, in <module>    from scapy.all import *  File "/Library/Python/2.7/site-packages/scapy/all.py", line 16, in <module>    from arch import *  File "/Library/Python/2.7/site-packages/scapy/arch/__init__.py", line 75, in <module>    from bsd import *  File "/Library/Python/2.7/site-packages/scapy/arch/bsd.py", line 12, in <module>    from unix import *  File "/Library/Python/2.7/site-packages/scapy/arch/unix.py", line 20, in <module>    from pcapdnet import *  File "/Library/Python/2.7/site-packages/scapy/arch/pcapdnet.py", line 160, in <module>    import dnetImportError: No module named dnet

I can use both the Scapy and Python interactive interpreters and running import scapy in the Python interpreter produces no errors.When the script was run initially the pcapy module was missing, however I installed thatand then the issue switched to dnet, which I cannot find a solution for.A similar post, seems to describe the same issue but the workarounds have no effect.Can anybody shed any more light on this issue?

Commands used to install pcapy and libdnet:

libdnet-1.11.tar.gz (01-19-2005)

` ~/Downloads/libdnet-1.11  chmod a+x configure ~/Downloads/libdnet-1.11  ./configure  && make`

Exits successfully

Pcapy: Latest stable release (0.10.8), updated August 26, 2010

~/Downloads/pcapy-0.10.8 
sudo python setup.py installPassword:running installrunning buildrunning build_extrunning build_scriptsrunning install_librunning install_scriptschanging mode of /usr/local/bin/96pings.pcap to 777changing mode of /usr/local/bin/pcapytests.py to 777running install_datarunning install_egg_infoRemoving /Library/Python/2.7/site-packages/pcapy-0.10.8-py2.7.egg-infoWriting /Library/Python/2.7/site-packages/pcapy-0.10.8-py2.7.egg-info ~/Downloads/pcapy-0.10.8 

Results for compiling with new flags

 ~/Downloads/libdnet-1.12  sudo CFLAGS='-arch i386 -arch x86_64' ./configure --prefix=/usr and archargs='-arch i386 -arch x86_64' makeconfigure: WARNING: you should use --build, --host, --targetconfigure: WARNING: you should use --build, --host, --targetchecking for a BSD-compatible install... /usr/bin/install -cchecking whether build environment is sane... yes/Users/richardcurteis/Downloads/libdnet-1.12/config/missing: Unknown `--is-lightweight' optionTry `/Users/richardcurteis/Downloads/libdnet-1.12/config/missing --help' for more informationconfigure: WARNING: 'missing' script is too old or missingchecking for a thread-safe mkdir -p... config/install-sh -c -dchecking for gawk... nochecking for mawk... nochecking for nawk... nochecking for awk... awkchecking whether make sets $(MAKE)... yeschecking whether make supports nested variables... yeschecking whether to enable maintainer-specific portions of Makefiles... nochecking build system type... Invalid configuration `and': machine `and' not recognizedconfigure: error: /bin/sh config/config.sub and failed ~/Downloads/libdnet-1.12  

Viewing all articles
Browse latest Browse all 6

Latest Images

Trending Articles





Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>
<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596344.js" async> </script>