QuestionQ216

Reconnaissance and Enumeration

A penetration tester creates the following script to enumerate a /24 network:

Question Image

The tester runs the script, but it returns this error:

-bash: syntax error near unexpected token ‘ping’

What should the tester do to correct the error?

  • A Add do after line 2.
  • B Replace {1..254} with $(seq 1 254).
  • C Replace bash with zsh.
  • D Replace $i with $[i].
Explanation

A Bash for loop requires do before the commands in its loop body. Adding do after the iterator declaration makes ping -c1 192.168.1.$i the loop body and resolves the syntax error.

Community Discussion

No comments yet. Be the first to start the discussion!