我已经安装了nmap.exe文件以及nmap模块。但我不确定如何配置nmap路径。

输入nmap路径的代码块如下所示class PortScanner(object):

"""

PortScanner class allows to use nmap from python

"""

def __init__(self, nmap_search_path=('nmap','/usr/bin/nmap','/usr/local/bin/nmap','/sw/bin/nmap','/opt/local/bin/nmap') ):

"""

Initialize PortScanner module

* detects nmap on the system and nmap version

* may raise PortScannerError exception if nmap is not found in the path

:param nmap_search_path: tupple of string where to search for nmap executable. Change this if you want to use a specific version of nmap.

:returns: nothing

"""

self._nmap_path = 'C:/Program Files (x86)/Nmap/' # nmap path

self._scan_result = {}

self._nmap_version_number = 0 # nmap version number

self._nmap_subversion_number = 0 # nmap subversion number

self._nmap_last_output = '' # last full ascii nmap output

is_nmap_found = False # true if we have found nmap

self.__process = None

# regex used to detect nmap

regex = re.compile('Nmap version [0-9]*\.[0-9]*[^ ]* \( http://.* \)')

# launch 'nmap -V', we wait after 'Nmap version 5.0 ( http://nmap.org )'

# This is for Mac OSX. When idle3 is launched from the finder, PATH is not set so nmap was not found

for nmap_path in nmap_search_path:

try:

p = subprocess.Popen([nmap_path, '-V'], bufsize=10000, stdout=subprocess.PIPE)

except OSError:

pass

else:

self._nmap_path = nmap_path # save path

break

else:

raise PortScannerError('nmap program was not found in path. PATH is : {0}'.format(os.getenv('PATH')))

我将路径放入self.\nmap_path变量中。然而,这似乎行不通。

有nmap经验的人能帮我吗?如何开始使用nmap?我已经研究了几个小时,但仍然没有找到答案。

我收到的错误是

^{pr2}$

python nmap模块详解_python中的Nmap模块问题相关推荐

  1. python中configparser详解_Python中的ConfigParser模块使用详解

    1.基本的读取配置文件 -read(filename) 直接读取ini文件内容 -sections() 得到所有的section,并以列表的形式返回 -options(section) 得到该sect ...

  2. python scatter参数详解_Python中scatter函数参数及用法详解

    最近开始学习Python编程,遇到scatter函数,感觉里面的参数不知道什么意思于是查资料,最后总结如下: 1.scatter函数原型 2.其中散点的形状参数marker如下: 3.其中颜色参数c如 ...

  3. python scatter参数详解_Python 中 scatter 函数参数及用法详解

    Python 中 scatter 函数参数及用法详解 Python 中 scatter 函数参数及用法详解 这里有新鲜出炉的 Python 教程, 程序狗速度看过来! Python 编程语言 Pyth ...

  4. python算术运算符详解_Python中关于算术运算符的实例详解

    这篇文章主要介绍了Python算术运算符实例详解的相关资料,需要的朋友可以参考下 Python算术运算符 以下假设变量a为10,变量b为20: 运算符 描述 实例 + 加 - 两个对象相加 a + b ...

  5. python argparse模块详解_python中argparse模块用法实例详解

    本文实例讲述了python中argparse模块用法.分享给大家供大家参考.具体分析如下: 平常在写命令行工具的时候,经常会带参数,所以用python中的argparse来实现. # -*- codi ...

  6. python wx模块详解_python中wx模块的具体使用方法

    wx包中的方法都是以大写字母开头的,而这和Python的习惯是相反的. 本节介绍如何创建python程序的图形用户界面(GUI),也就是那些带有按钮和文本框的窗口.这里介绍wxPython : 根据自 ...

  7. python sys模块详解_python中os和sys模块的区别与常用方法总结

    {"moduleinfo":{"card_count":[{"count_phone":1,"count":1}],&q ...

  8. python argparse模块详解_python学习之argparse模块

    一.介绍 argparse是python用于解析命令行参数和选项的标准模块,用于代替已经过时的optparse模块.argparse模块的作用是用于解析命令行参数. 我们很多时候,需要用到解析命令行参 ...

  9. python scatter参数详解_Python中scatter函数参数用法详解

    原博文 2018-10-21 16:09 − 1.scatter函数原型 2.其中散点的形状参数marker如下: 3.其中颜色参数c如下: 4.基本的使用方法如下: #导入必要的模块 import ...

最新文章

  1. Mysql排序后显示排序序号
  2. 【鬼网络】之DHCP原理与配置
  3. python学习笔记——类
  4. rxjs interval和take的混合使用
  5. Qt 之 消息机制和事件讲解
  6. Linux 0.11 内核解析:中断相关(1)asm.s文件中断处理分析
  7. java 静态方法_80后程序员,教你学Java核心技术:用户自定义类+静态域静态方法
  8. 大数据处理需注意的问题
  9. python的类与继承
  10. The Application of Stack in Expression Calculation
  11. java实现dex转jar_dex转jar工具
  12. wsimport的使用
  13. html flex上下居中,CSS3 Flex实现元素的水平居中和垂直居中
  14. 基于CTP的期货智能程序化交易系统平台
  15. 讨论数据增强(data augmentation)的有效性
  16. 算法实现: OTP(One-Time Pad) 一次一密密码本 加解密
  17. 完美解决“未能装载Office文档控件。请使用Internet Explorer(6.0+)浏览器并检查浏览器的安全设置。”的方案
  18. Dev-C++5.11游戏创作之简易小炸弹
  19. 阿里云域名购买流程和备案流程
  20. poi设置表格内容水平垂直居中

热门文章

  1. 优化Nginx的处理性能
  2. could not connect to server: No route to host Is the server running on host 192.168.163.181 and a
  3. bat脚本中,常用的开头与结尾(关闭回显,让输出变得更加简洁)
  4. 【PostgreSQL-9.3.17】CentOS-6.7安装PostgreSQL-9.3.17
  5. SpringMvc 400 Bad Request解决方法
  6. python读取和写入excel里面的数据(附int变float解决方法)
  7. Win10微软帐户切换不回Administrator本地帐户的解决方法【亲测】
  8. Android 屏幕适配:最全面的解决方案
  9. linux下RTNETLINK answers: File exists的解决方案
  10. 如何清除/删除终端中的当前行?