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.


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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.