How do you scan a specific port range in Nmap, for example ports 80, 443, and 1024-1050?

Study for the Nmap/ZenMap Switches Test. Prepare with flashcards and multiple choice questions, each question provides hints and explanations. Get ready for your exam!

Multiple Choice

How do you scan a specific port range in Nmap, for example ports 80, 443, and 1024-1050?

Explanation:
In Nmap, the -p option controls which ports are scanned. You can mix individual ports with port ranges by listing them separated with commas. For your target of ports 80, 443, and the range 1024-1050, the correct syntax is -p 80,443,1024-1050. This exactly specifies the two single ports plus the block from 1024 through 1050. This works because -p accepts a comma-separated list of ports and ranges, and the range 1024-1050 includes every port from 1024 to 1050 inclusive. Using a range like 80-443 would scan every port between 80 and 443, which isn’t the same as scanning only 80 and 443. And using spaces or a non-existent flag like -ports would not be parsed correctly by Nmap.

In Nmap, the -p option controls which ports are scanned. You can mix individual ports with port ranges by listing them separated with commas. For your target of ports 80, 443, and the range 1024-1050, the correct syntax is -p 80,443,1024-1050. This exactly specifies the two single ports plus the block from 1024 through 1050.

This works because -p accepts a comma-separated list of ports and ranges, and the range 1024-1050 includes every port from 1024 to 1050 inclusive. Using a range like 80-443 would scan every port between 80 and 443, which isn’t the same as scanning only 80 and 443. And using spaces or a non-existent flag like -ports would not be parsed correctly by Nmap.

Subscribe

Get the latest from Examzify

You can unsubscribe at any time. Read our privacy policy