Reconnaissance and Enumeration

A tester's Bash sweep prints nothing although hosts are up: `for i in $(seq 1 254); do ping -c 1 -W 1 10.10.5.i &>/dev/null && echo 10.10.5.$i; done`. Which change fixes it?

Show the answer

Correct answerD. Change 10.10.5.i to 10.10.5.$i in the ping command

AWhy not this: -n 1 is Windows ping syntax; on Linux -c sets the count and -n means numeric output.

BWhy not this: Using ; would echo every address whether or not ping succeeded, losing the live-host filter.

CWhy not this: 1..254 is PowerShell range syntax; Bash does not expand it, and seq already works here.

DWhy this is right: Bash needs $i to expand the loop variable; a bare i is literal text and the ping fails.

Without the $ prefix, Bash treats 'i' as literal text, so ping targets an invalid address and always fails. Using $i expands the loop variable. The 1..254 range is PowerShell syntax; Bash needs seq or {1..254}.