python scapy模块安装后引用错误_python – scapy安装失败在osx与dnet导入错误
麻烦安装Scapy,它是必需的依赖。我已经花了一些时间Googling解决方案,但所有的“解决方案”似乎影响旧版本的Python,或者根本不起作用。
脚本:
#!/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版本是2.7.5,并经过Python验证。
which python
/usr/bin/python
当脚本执行时,我得到以下错误:
./multi-threaded-scanner.py
Traceback (most recent call last):
File "./multi-threaded-scanner.py", line 6, in
from scapy.all import *
File "/Library/Python/2.7/site-packages/scapy/all.py", line 16, in
from arch import *
File "/Library/Python/2.7/site-packages/scapy/arch/__init__.py", line 75, in
from bsd import *
File "/Library/Python/2.7/site-packages/scapy/arch/bsd.py", line 12, in
from unix import *
File "/Library/Python/2.7/site-packages/scapy/arch/unix.py", line 20, in
from pcapdnet import *
File "/Library/Python/2.7/site-packages/scapy/arch/pcapdnet.py", line 160, in
import dnet
ImportError: No module named dnet
我可以使用Scapy和Python交互式解释器,并在Python解释器中运行import scapy不产生错误。
当脚本最初运行时,pcapy模块丢失,但是我安装了
然后问题切换到dnet,我找不到解决方案。
A similar post,似乎描述了同样的问题,但解决方法没有任何效果。
有人可以在这个问题上再说一遍吗?
用于安装pcapy和libdnet的命令:
libdnet-1.11.tar.gz(01-19-2005)
` ~/Downloads/libdnet-1.11
chmod a+x configure
~/Downloads/libdnet-1.11
./configure && make`
退出成功
Pcapy:最新的稳定版本(0.10.8),更新于2010年8月26日
〜/下载/ pcapy-0.10.8
sudo python setup.py安装
密码:
运行安装
运行构建
运行build_ext
运行build_scripts
运行install_lib
运行install_scripts
将/usr/local/bin/96pings.pcap的模式更改为777
将/usr/local/bin/pcapytests.py更改为777模式
运行install_data
运行install_egg_info
删除/Library/Python/2.7/site-packages/pcapy-0.10.8-py2.7.egg-info
写/Library/Python/2.7/site-packages/pcapy-0.10.8-py2.7.egg-info
〜/下载/ pcapy-0.10.8
使用新标志进行编译的结果
~/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
python scapy模块安装后引用错误_python – scapy安装失败在osx与dnet导入错误相关推荐
- Google Analytics 跟踪代码安装后状态总是显示'未安装跟踪代码'
最近要使用Google Analytics,但是在跟踪代码安装后状态总是显示'未安装跟踪代码'!如下所示: 在Google Analytics的帮助中"排查常见的跟踪设置错误" ...
- 关于C#winform程序运行无异常,在生成安装文件安装后提示水晶报表加载失败,系统找不到指定的路径的解决方法...
关于C#winform程序运行无异常,在生成安装文件安装后提示"水晶报表加载失败,系统找不到指定的路径"的解决方法 娘了个腿的!搞了好几天,百度都被我搜烂了,连发布相关内容的作者名 ...
- 树莓派安装后中文设置及输入法安装
转:https://www.cnblogs.com/tdm8/p/10288153.html 树莓派安装后中文设置及输入法安装 树莓派(raspberry pi)的原版是没有中文支持的,需安装 第一步 ...
- com加载项没反应 ppt wps_islide安装后不显示怎么办?islide安装后用PPT2016打开不显示的原因及解决方法介绍...
islide安装后不显示怎么办?islide是一款功能十分强大的PPT美化工具,受到了很多行业人士的青睐,其中不仅能对PPT进行美化处理,还有海量的PPT模板,让你再也不用担心领导为你安排制作PPT的 ...
- python 不同模块之间的引用错误问题
今天,在相同环境下的不同模块之间,在lib下面总是有错误提示的红色波浪线,最开始我以为是虚拟环境的位置不对,导致所有的模块不在同一个环境下,所有无法进行模块之间的引用,在试了好多次之后,发现根本不是这 ...
- python redis模块_大数据入门4 | Redis安装及python中的redis模块加载
引:前面学习了中文分词.HMM.jieba...这些有很多内容需要总结,但是时间太紧,一下写不完.所以前面的就先放一边,届时复习时再写吧. 今天把刚学的遇到的问题总结一下. 实践部分遇到的问题: 1. ...
- python安装了怎么使用_Python PyCharm 安装与简单使用
Python下载地址: https://www.python.org/downloads/windows/ 根据你的系统要求,安装你所需要的版本. 其实Python的安装简单得很,直接跟进下一步就OK ...
- python安装要什么配置_Python的安装和详细配置
Python是一种面向对象.解释型计算机程序设计语言.被认为是比较好的胶水语言.至于其他的,你可以去百度一下.本文仅介绍python的安装和配置,供刚入门的朋友快速搭建自己的学习和开发环境.本人欢迎大 ...
- python安装第三方扩展包_Python之安装第三方扩展库
PyPI 地址:https://pypi.python.org/pypi 如果你知道你要找的库的名字,那么只需要在右上角搜索栏查找即可. 1.pip安装扩展库 (1)安装最新版本的扩展库: cmd&g ...
最新文章
- 小乐乐打游戏(BFS+曼哈顿距离)
- 科大星云诗社动态20210806
- Netlink实现热拔插监控
- python函数和方法的编写原则_跟老齐学Python之传说中的函数编写条规
- 面试必会之HashMap源码分析
- Mysql学习总结(50)——Oracle,mysql和SQL Server的区别
- 《我是一只IT小小鸟》
- 硅谷之火:人与计算机的未来
- 【微信支付】小案例,Java版
- 华为海思芯片 10 年备胎史!
- 台式计算机怎样时间同步,电脑时间同步,详细教您怎么让电脑时间和网络时间同步...
- at89s51单片机是几位微型计算机,单片机原理章习题
- Unipus-writing exercise Expository_Text_09
- docker安装及加速器
- Win10便签在哪?Win10桌面便签怎么打开和使用?
- echarts地图导航飞线与层级穿透
- Kotlin上的反应式流-SharedFlow和StateFlow
- 报警器语音ic单片机芯片如何选型
- 思科德Exynos4412(2G内存)四核平板电脑方案
- BUUCTF-pwn(18)