Reconnaissance and Enumeration
A recon script should print "host up" only when a ping to the target succeeds. Which construct makes that decision?
Show the answer
Correct answerD. if statement
AWhy not this: A for loop repeats a block for each item; it does not test whether the ping succeeded.
BWhy not this: Concatenation joins strings together; it makes no decision about running code.
CWhy not this: Incrementing changes a number's value; it does not test a result.
DWhy this is right: It executes its block only when the tested condition, the ping result, is true.
An if statement runs its block only when its test evaluates true, such as a successful ping exit code. A for loop repeats code over a sequence and does not decide whether code runs based on a result.