我只是想创建一个nmap.PortScanner()对象。但是,每当运行此行代码时,都会出现以下错误

>>> import nmap
>>> nmap.PortScanner()
Traceback (most recent call last):
  File "<pyshell#5>", line 1, in <module>
    nmap.PortScanner()
  File "C:\Python32\lib\site-packages\nmap\nmap.py", line 170, in __init__
raise PortScannerError('nmap program was not found in path. PATH is : {0}'.format(os.getenv('PATH')))
nmap.nmap.PortScannerError: 'nmap program was not found in path. PATH is : C:\\Windows\\system32;C:\\Windows;C:\\Windows\\System32\\Wbem;C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\;C:\\Program Files (x86)\\ATI Technologies\\ATI.ACE\\Core-Static;C:\\Program Files (x86)\\QuickTime\\QTSystem\\'

我已经通过运行'python setup.py install'安装了nmap
我如何使nmap工作?

最佳答案

  • 确保安装nmap并将其添加到文件路径。
  • 我正在使用python 2.7并遇到了持续的问题,这是解决方法:
  • 打开nmap.py
  • 转到第116行
  • 将(http://nmap.org)更改为(https://nmap.org)
  • 10-08 11:57