nerdexam
CompTIA

PT0-003 · Question #295

During an engagement, a penetration tester receives a list of target systems and wants to enumerate them for possible vulnerabilities. The tester finds the following script on the internet: After…

The correct answer is B. Insert the following line before line 6: target = target.split(" ")[0]. f.readlines() returns each line including trailing newline and any extra fields (labels). Given targets.txt lines contain URL followed by a label separated by whitespace, target will contain Splitting the line on whitespace and taking the first element (target.split(" ")[0] or…

Submitted by diego_uy· Mar 6, 2026Reconnaissance and enumeration

Question

During an engagement, a penetration tester receives a list of target systems and wants to enumerate them for possible vulnerabilities. The tester finds the following script on the internet:

After running the script, the tester runs the following command:

Which of the following should the tester do next?

Exhibit

PT0-003 question #295 exhibit

Options

  • AReplace line 4 with the following: api = "/api/v2/getToken/data/id/None"
  • BInsert the following line before line 6: target = target.split(" ")[0]
  • DReplace line 7 with the following: response = requests.post(url, api)

How the community answered

(30 responses)
  • A
    7% (2)
  • B
    77% (23)
  • D
    17% (5)

Explanation

f.readlines() returns each line including trailing newline and any extra fields (labels). Given targets.txt lines contain URL followed by a label separated by whitespace, target will contain Splitting the line on whitespace and taking the first element (target.split(" ")[0] or better removes the descriptive label and newline so the resulting url is valid.

Topics

#scripting#Python#data parsing#network enumeration

Community Discussion

No community discussion yet for this question.

Full PT0-003 Practice