CompTIA PenTest+ (PT0-003) — Question 185

A penetration tester uses a Python script to enumerate open ports across a list of IP addresses. The current script runs sequentially, which slows it down during larger engagements. The tester wants to improve the script’s performance so it can handle multiple targets simultaneously.

Which of the following changes is the best way to achieve this goal?

Answer options

Correct answer: B

Explanation

The best option is B, as importing a library that allows the use of workers enables concurrent execution of port scans, significantly improving performance. Option A would actually slow down the scanning process by introducing delays, while options C and D do not address the issue of parallel processing and thus would not enhance the script's efficiency.