nerdexam
CompTIA

PT0-003 · Question #303

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…

The correct answer is B. Importing a library that allows use of workers. Using a worker-based concurrency approach (such as a thread/process pool) allows the script to scan multiple targets in parallel, significantly improving throughput for network I/O-bound tasks like port enumeration.

Submitted by klara.se· Mar 6, 2026Reconnaissance and enumeration

Question

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?

Options

  • AUsing the function to throttle the scanning rate
  • BImporting a library that allows use of workers
  • CReplacing the function with a loop
  • DChanging the port list from a tuple to a dictionary for better lookup speed

How the community answered

(41 responses)
  • A
    7% (3)
  • B
    76% (31)
  • C
    15% (6)
  • D
    2% (1)

Explanation

Using a worker-based concurrency approach (such as a thread/process pool) allows the script to scan multiple targets in parallel, significantly improving throughput for network I/O-bound tasks like port enumeration.

Topics

#scripting optimization#Python concurrency#port scanning#network enumeration

Community Discussion

No community discussion yet for this question.

Full PT0-003 Practice