1

Can anyone tell me how, or if it possible to get nmap to write output to a file if ALL of the ports defined in the scan are open? Such as in a boolean & statement - i.e. 636 & 902 & 5989

For example, I am trying to find all VMware-related ports in a scan by looking for ports 636, 902 and 5989 being open. The scan I am using is

nmap -T5 -sV -P0 -O -iL dc-subnets -p 902,636,5989 --open > vmware

This works fine in that I can see the open ports and the version data shows 'vmware', however I want to concentrate purely on the ports and only write to file the hosts that have all 3 ports open.

S.L. Barth
  • 5,486
  • 8
  • 38
  • 47
C. Cronk
  • 11
  • 1

1 Answers1

2

I don't believe that nmap has this capability natively within the program, however it would be relatively easy to achieve this goal with a scripting language after the scan has completed.

For an example when using Ruby you could use something like the ruby-nmap gem to parse your output and return a list of hosts that have those three ports open.

Rory McCune
  • 60,923
  • 14
  • 136
  • 217
  • Parsers for other languages: [Nmap::Parser](http://search.cpan.org/~apersaud/Nmap-Parser/) for Perl, [Ndiff](https://nmap.org/ndiff/) (included with Nmap) for Python 2, [python-nmap](https://pypi.python.org/pypi/python-nmap) for Python 3, [parse-nmap.ps1](https://cyber-defense.sans.org/blog/2009/06/11/powershell-script-to-parse-nmap-xml-output/) for PowerShell. – bonsaiviking Aug 13 '15 at 12:01