Given X!=Y, is there any way to scan the top (--top-ports) X TCP ports and the top Y UDP ports using a simple Nmap command?

The --top-ports parameter affects both the TCP and UDP scans (e.g., when -sSU is used).

If exists, short/simple command is preferred.


From this post it looks like the best way to do this would be to find out what the port lists for each option are and then supply them as a list of ports to scan on the command line, as you can specify different lists of TCP and UDP ports to scan using the -p option by using T: and U:

To quote the relevant part of that post

but I first generate the list of top UDP ports (10 in this case):

./nmap -oX - -sU --top-ports 10

The output 'scaninfo' line includes the services list in Nmap format:


So then I can run Nmap with:

-p T:1-65535,U:53,67,123,135,137-138,161,445,631,1434 `

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.