Here are all the actual test exam dumps for IT exams. Most people prepare for the actual exams with our test dumps to pass their exams. So it's critical to choose and actual test pdf to succeed.

Exam PT0-003 Topic 3 Question 233 Discussion

Actual exam question for CompTIA's PT0-003 exam
Question #: 233
Topic #: 3
A penetration tester writes a Bash script to automate the execution of a ping command on a Class C network:
bash
for var in -MISSING TEXT-
do
ping -c 1 192.168.10.$var
done
Which of the following pieces of code should the penetration tester use in place of the -MISSING TEXT- placeholder?

Suggested Answer: B Vote an answer

Correct Syntax for a Range Loop in Bash:
The seq command generates a sequence of numbers in a specified range, which is ideal for iterating over IP addresses in a Class C subnet (1-254).
Example: seq 1 254 will output numbers 1, 2, ..., 254 sequentially.
Explanation of Other Options:
A (crunch): The crunch command is used for wordlist generation and is unrelated to looping in Bash.
C (echo 1-254): This would output "1-254" as a string instead of generating a numeric range.
D ({1.-254}): This is incorrect Bash syntax and would result in a script error.
Final Script:
bash
for var in $(seq 1 254)
do
ping -c 1 192.168.10.$var
done
CompTIA Pentest+ Reference:
Domain 4.0 (Penetration Testing Tools)
Bash Scripting and Automation

by Harvey at Jun 22, 2026, 08:13 PM

Comments

Chosen Answer:
This is a voting comment (?) , you can switch to a simple comment.
Switch to a voting comment New
Nick name: Submit Cancel
A voting comment increases the vote count for the chosen answer by one.

Upvoting a comment with a selected answer will also increase the vote count towards that answer by one. So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.