WSL2 works with Nmap directly and is generally recommended instead of Cygwin. For those who do need Cygwin, it’s possible to use Nmap from Cygwin, silently calling Windows Nmap.
This is the Right Way™ to do it. The Nmap Windows build is solid and uses Windows-specific API calls to do things really fast and well. Even if WSL ever supports the Linux build, it won't be as good as native. https://t.co/r2PkSxuoJE— Daniel Miller ✝ (@bonsaiviking) May 22, 2018
Install by download nmap.
Install nmap “self-installer”
.exe. When asked, also install Npcap.
Cygwin: add to
~/.bash_profile the following. Note the
\( are vital for Cygwin shell to interpret the command correctly.
alias nmap="/cygdrive/c/Program\ Files\ \(x86\)/Nmap/nmap.exe"
Open a new Cygwin window to start using
Test nmap in Cygwin:
Starting Nmap ( https://nmap.org ) Nmap scan report for 18.104.22.168 Host is up (0.0092s latency). Not shown: 998 filtered ports PORT STATE SERVICE 53/tcp open domain 443/tcp open https Nmap done: 1 IP address (1 host up) scanned in 7.41 seconds
- errors about interface → try running Cygwin as Administrator (right click on Cygwin icon).
- find interface names available to nmap
- to find servers with a particular port open on a subnet, try my Python findssh program that scans for servers without nmap.
- If you don’t install Npcap when asked in the
nmapdoes not work. Nmap claims no host existed at a known working IP address.