Nmap can take a file containing a list of hosts to scan using the
Is there similar functionality for a file containing a list of port numbers?
I've scoured the man page, online docs at nmap.org and Googled, but nothing as of yet.
Not by itself, no. But with some quick scripting you can.
For example, on *nix systems:
nmap -p `cat ports.list` ...
This would allow you to maintain a list of ports in a file in a CSV format.
If you would prefer to have one port per line, you can do this (thanks @bonsaiviking) on *nix systems:
nmap -p $(tr '\n' , <ports.list)
Yes, it can, by using the targets-xml Nmap NSE script
Update: Actually, the functionality isn't yet in there, but it looks as if it is planned.
Yes, Nmap can take a file in the services file format with the
--servicedb option. This also implies the
-F option, meaning that only the services listed in that file will be scanned.* So just supply the services you want to scan in this format and you can accomplish this goal.
* The exception to this is if the file includes port frequency data like the
nmap-services file bundled with Nmap. In that case,
-F means to scan the 100 most-likely ports based on that frequency data.