If you want to scan only ports 22 and 3389, which -p syntax would you use?

Prepare for the Nmap and ZenMap Tests. Access flashcards and multiple choice questions, with hints and explanations for each question. Ensure success in your exam!

Multiple Choice

If you want to scan only ports 22 and 3389, which -p syntax would you use?

Explanation:
In Nmap, the -p option accepts ports as a list or as ranges, with a comma used to separate individual ports. To scan only two specific ports, you list them exactly as discrete values separated by a comma. So for ports 22 and 3389, you would use -p 22,3389. A range like 22-3389 would include every port between 22 and 3389, which isn’t what you want. Writing -p 22 3389 without a comma isn’t valid syntax for specifying multiple ports, and mixing a range with a specific port or adding extra pieces (like 22-3389,3389) doesn’t restrict the scan to just those two ports.

In Nmap, the -p option accepts ports as a list or as ranges, with a comma used to separate individual ports. To scan only two specific ports, you list them exactly as discrete values separated by a comma. So for ports 22 and 3389, you would use -p 22,3389. A range like 22-3389 would include every port between 22 and 3389, which isn’t what you want. Writing -p 22 3389 without a comma isn’t valid syntax for specifying multiple ports, and mixing a range with a specific port or adding extra pieces (like 22-3389,3389) doesn’t restrict the scan to just those two ports.

Subscribe

Get the latest from Passetra

You can unsubscribe at any time. Read our privacy policy