What is the practical use of grepable output (-oG) from a scan?

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

What is the practical use of grepable output (-oG) from a scan?

Explanation:
Greppable output is designed for easy text processing with command-line tools. When you run a scan with -oG, Nmap writes each relevant line in a predictable format that highlights the host and its ports with the state included. Because open ports are labeled with /open/, you can filter the results programmatically by grepping for that string. This lets you build scripts to compile lists of open ports or hosts with open services without manually reading the output. For instance, piping the -oG output through grep '/open/' will narrow the results to open ports, and you can then extract just the port numbers with additional tools like awk or cut. The other options misstate the output: it's not binary, it doesn't save to a default file named 'grep', and it isn't JSON—it's a text format intended for easy parsing.

Greppable output is designed for easy text processing with command-line tools. When you run a scan with -oG, Nmap writes each relevant line in a predictable format that highlights the host and its ports with the state included. Because open ports are labeled with /open/, you can filter the results programmatically by grepping for that string. This lets you build scripts to compile lists of open ports or hosts with open services without manually reading the output. For instance, piping the -oG output through grep '/open/' will narrow the results to open ports, and you can then extract just the port numbers with additional tools like awk or cut. The other options misstate the output: it's not binary, it doesn't save to a default file named 'grep', and it isn't JSON—it's a text format intended for easy parsing.

Subscribe

Get the latest from Examzify

You can unsubscribe at any time. Read our privacy policy