nerdexam
CompTIA

PT0-003 · Question #30

A penetration tester creates a list of target domains that require further enumeration. The tester writes the following script to perform vulnerability scanning across the domains: line 1…

The correct answer is D. Change line 5 to done < "$DOMAINS_LIST". The issue with the script lies in how the while loop reads the file containing the list of domains. The current script doesn't correctly redirect the file's content to the loop. Changing line 5 to done < "$DOMAINS_LIST" correctly directs the loop to read from the file.

Submitted by lucia.co· Mar 6, 2026Vulnerability Discovery and Analysis

Question

A penetration tester creates a list of target domains that require further enumeration. The tester writes the following script to perform vulnerability scanning across the domains:

line 1: #!/usr/bin/bash line 2: DOMAINS_LIST = "/path/to/list.txt" line 3: while read -r i; do line 4: nikto -h $i -o scan-$i.txt & line 5: done The script does not work as intended. Which of the following should the tester do to fix the script?

Options

  • AChange line 2 to {"domain1", "domain2", "domain3", }.
  • BChange line 3 to while true; read -r i; do.
  • CChange line 4 to nikto $i | tee scan-$i.txt.
  • DChange line 5 to done < "$DOMAINS_LIST".

How the community answered

(36 responses)
  • A
    6% (2)
  • B
    11% (4)
  • C
    3% (1)
  • D
    81% (29)

Explanation

The issue with the script lies in how the while loop reads the file containing the list of domains. The current script doesn't correctly redirect the file's content to the loop. Changing line 5 to done < "$DOMAINS_LIST" correctly directs the loop to read from the file.

Topics

#shell scripting#bash scripting#vulnerability scanning#script debugging#Nikto

Community Discussion

No community discussion yet for this question.

Full PT0-003 Practice