Reconnaissance and Enumeration
A Python script sets ssh_open and web_open to True when the matching ports are open. A host should be flagged only when SSH is open and no web port is open. Which condition does this?
Show the answer
Correct answerD. ssh_open and not web_open
AWhy not this: This is true when at least one of the two ports is closed, so it also flags hosts with SSH closed.
BWhy not this: or is true whenever either side is true, so a host with SSH closed and web closed is wrongly flagged.
CWhy not this: This inverts the requirement: it matches hosts with SSH closed and web open.
DWhy this is right: and needs both tests true, and not turns a closed web port into True, so only SSH-open, web-closed hosts match.
Both tests must hold, so and joins them, and not inverts the web test so that a closed web port counts. The or version is also true when SSH is closed but web is closed, so it flags hosts that have no open SSH.