Probleme mit der Installation von Scapy und den erforderlichen Abhängigkeiten. Ich habe einige Zeit damit verbracht, nach einer Lösung zu suchen, aber alle "Lösungen" scheinen ältere Versionen von Python zu beeinflussen oder funktionieren einfach nicht.Scapy-Installation schlägt auf osx mit dnet-Importfehler fehl
Script:
#!/usr/bin/python
import threading
import Queue
import time
from 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 += 1
queue = 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' %i
for j in range(1, 100) :
queue.put(j)
queue.join()
for item in threads :
item.join()
print 'Scanning complete'
Python-Version ist 2.7.5 und den Pfad zu Python verifiziert.
which python
/usr/bin/python
Wenn Skript ausgeführt wird, ich die folgende Störung erhalte:
./multi-threaded-scanner.py
Traceback (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 dnet
ImportError: No module named dnet
ich sowohl die scapy und interaktive Python-Interpreter verwenden können, und erzeugt keine Fehler in den Python-Interpreter import scapy
ausgeführt wird. Als das Skript anfänglich ausgeführt wurde, fehlte das pcapy
Modul, aber ich installierte das und dann wechselte das Problem zu dnet, für das ich keine Lösung finden kann. A similar post, scheint das gleiche Problem zu beschreiben, aber die Problemumgehungen haben keine Auswirkungen. Kann jemand mehr Licht in dieses Thema bringen?
Befehle pcapy und libdnet zu installieren:
libdnet-1.11.tar.gz (01-19-2005)
` ~/Downloads/libdnet-1.11
chmod a+x configure
~/Downloads/libdnet-1.11
./configure && make`
Exits erfolgreich
Pcapy: letzte Version (0,10 0,8), aktualisiert 26. August 2010
~/Downloads/pcapy-0.10.8
sudo python setup.py install Password: running install running build running build_ext running build_scripts running install_lib running install_scripts changing mode of /usr/local/bin/96pings.pcap to 777 changing mode of /usr/local/bin/pcapytests.py to 777 running install_data running install_egg_info Removing /Library/Python/2.7/site-packages/pcapy-0.10.8-py2.7.egg-info Writing /Library/Python/2.7/site-packages/pcapy-0.10.8-py2.7.egg-info ~/Downloads/pcapy-0.10.8
Ergebnisse für mit neuen Flags kompilieren
~/Downloads/libdnet-1.12
sudo CFLAGS='-arch i386 -arch x86_64' ./configure --prefix=/usr and archargs='-arch i386 -arch x86_64' make
configure: WARNING: you should use --build, --host, --target
configure: WARNING: you should use --build, --host, --target
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
/Users/richardcurteis/Downloads/libdnet-1.12/config/missing: Unknown `--is-lightweight' option
Try `/Users/richardcurteis/Downloads/libdnet-1.12/config/missing --help' for more information
configure: WARNING: 'missing' script is too old or missing
checking for a thread-safe mkdir -p... config/install-sh -c -d
checking for gawk... no
checking for mawk... no
checking for nawk... no
checking for awk... awk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking whether to enable maintainer-specific portions of Makefiles... no
checking build system type... Invalid configuration `and': machine `and' not recognized
configure: error: /bin/sh config/config.sub and failed
~/Downloads/libdnet-1.12
Wie Sie installiert haben 'scapy' und' pcapy'? Welche Befehle hast du benutzt? Wurden Fehler gemeldet? Hast du ['libdnet'] (http://libdnet.sourceforge.net) installiert? – Yoel
Hinzugefügt am ursprünglichen Post. Alle werden erfolgreich beendet, und das Skript wird im aktualisierten Terminal erneut ausgeführt, aber mit dem gleichen Fehler. –
Was "OS" haben Sie? – Yoel