6
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 -

Set up a simple server. I want to connect to it with ncat to learn HTTP.

I install ncat (pip install nmap):

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

Then, when I try and connect, cmd not found. It was working earlier. Not sure how I broke it.

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

I am using git bash on windows, and I have set up python36 on c drive and changed env variables and path accordingly.

mrj
  • 849
  • 2
  • 8
  • 18

2 Answers2

3

I have been in this problem today and I solved it. the Nmap command must be in the $PATH environment variable for the discovery service account. To do this on windows do the following steps

  1. Click Start > Control Panel > System
  2. Click the Advanced tab, and select Environment Variables.
  3. Edit the Path system variable and add the directory where Nmap is installed.
  4. Restart the computer.

If you do this task, Nmap should be available to services on the computer and the command will be found in the terminal

Aya Muhammad
  • 73
  • 1
  • 11
2

The Python "nmap" package which you installed with pip install nmap is only an output parsing library. It does not include the Nmap binary. The "nmap" package available in the Windows Subsystem for Linux (a.k.a. Bash on Windows, a.k.a. Ubuntu on Windows) does not currently work properly and is unsupported.

The only place to get Nmap (and Ncat) in ready-to-use format (binary executable) on Windows is directly from nmap.org.

bonsaiviking
  • 5,825
  • 1
  • 20
  • 35