为啥在 Git Bash 上找不到 ncat?

Posted

技术标签:

【中文标题】为啥在 Git Bash 上找不到 ncat?【英文标题】:Why is ncat not found on Git Bash?为什么在 Git Bash 上找不到 ncat? 【发布时间】:2018-03-12 11:57:56 【问题描述】:
user_1 (master *) 1_EchoServer $ python -m http.server 8000

Serving HTTP on 0.0.0.0 port 8000 (http://0.0.0.0:8000/) ...
127.0.0.1 - - [30/Sep/2017 18:57:11] "GET / HTTP/1.1" 200 -

设置一个简单的服务器。我想用 ncat 连接它来学习 HTTP。

我安装ncat(pip install nmap):

    user_1 Documents $ pip install nmap
    Requirement already satisfied: nmap in c:\python36\lib\site-packages

然后,当我尝试连接时,找不到 cmd。它早些时候工作。不知道我是怎么弄坏的。

user_1 Documents $ pip install nmap
Requirement already satisfied: nmap in c:\python36\lib\site-packages
user_1 Documents $ ncat -l 9999
bash: ncat: command not found

我在 Windows 上使用 git bash,我已经在 c 驱动器上设置了 python36 并相应地更改了 env 变量和路径。

【问题讨论】:

【参考方案1】:

您使用pip install nmap 安装的Python“nmap”包只是一个输出解析库。它不包括 Nmap 二进制文件。适用于 Linux 的 Windows 子系统(也称为 Windows 上的 Bash,也称为 Windows 上的 Ubuntu)中可用的“nmap”包目前无法正常工作且不受支持。

在 Windows 上以即用型格式(二进制可执行文件)获取 Nmap(和 Ncat)的唯一位置是 directly from nmap.org。

【讨论】:

【参考方案2】:

我今天遇到了这个问题,我解决了。 Nmap 命令必须位于发现服务帐户的 $PATH 环境变量中。要在 Windows 上执行此操作,请执行以下步骤

    单击开始 > 控制面板 > 系统 单击“高级”选项卡,然后选择“环境变量”。 编辑Path系统变量,添加安装Nmap的目录。 重新启动计算机。

如果您执行此任务,计算机上的服务应该可以使用 Nmap,并且 该命令将在终端中找到

【讨论】:

以上是关于为啥在 Git Bash 上找不到 ncat?的主要内容,如果未能解决你的问题,请参考以下文章

MAC 上找不到.bash_profile该怎么办?

为啥我在操作菜单上找不到“调试托管内存”?

为啥我在操作菜单上找不到“调试托管内存”?

bash./ autogen 没有这个文件 ubuntu16.04git安装glog报错

为啥 Eclipse 在 Mac OSX 上找不到正则表达式?

为啥 composer 在 packagist.org 上找不到我的全新包?