Q: A penetration tester writes the following script to enumerate a /24 network: 1 #!/bin/bash 2 for i in {1..254} 3 ping -c1 192.168.1.$i 4 done The tester executes the script, but it fails with the following error: -bash: syntax error near unexpected token ‘ping’ Which of the following should the tester do to fix the error?
A: Add do after line 2
Reasoning: The missing do keyword is the reason for the syntax error. Bash for loops must include a do statement before executing commands within the loop. Corrected script: #!/bin/bash for i in {1..254}; do ping -c1 192.168.1.$i done