Reconnaissance and Enumeration

A tester has an Nmap greppable output file, scan.gnmap, whose lines begin "Host: 10.0.0.5 ()". The tester needs a list of only the IP addresses with port 445 open. Which command does this?

Show the answer

Correct answerC. grep "445/open" scan.gnmap | awk '{print $2}'

AWhy not this: The -v flag inverts the match, listing hosts that do not have 445 open.

BWhy not this: Field one is the literal text "Host:", so the output has no IP addresses.

CWhy this is right: It filters for open 445 lines and prints field two, the IP address.

DWhy not this: It filters for closed port 445, so the IPs listed are the wrong hosts.

grep keeps only lines showing 445/open, and awk prints the second whitespace-separated field, which is the IP address. Printing the first field returns only the literal word "Host:" on every line.