312-50V10 · Question #332
Which command lets a tester enumerate alive systems in a class C network via ICMP using native Windows tools?
The correct answer is D. for /L %V in (1 1 254) do PING -n 1 192.168.2.%V | FIND /I "Reply". The correct Windows FOR /L loop with a filtered PING command is the standard native method to sweep all 254 hosts in a Class C subnet.
Question
Which command lets a tester enumerate alive systems in a class C network via ICMP using native Windows tools?
Options
- Aping 192.168.2.
- Bping 192.168.2.255
- Cfor %V in (1 1 255) do PING 192.168.2.%V
- Dfor /L %V in (1 1 254) do PING -n 1 192.168.2.%V | FIND /I "Reply"
How the community answered
(27 responses)- A11% (3)
- B15% (4)
- C4% (1)
- D70% (19)
Why each option
The correct Windows FOR /L loop with a filtered PING command is the standard native method to sweep all 254 hosts in a Class C subnet.
`ping 192.168.2.` is invalid syntax and not a recognized command; it will fail to execute.
`ping 192.168.2.255` targets only the subnet broadcast address and does not individually probe each host in the range.
`for %V in (1 1 255)` without the `/L` flag iterates over a static set of literal values rather than generating a numeric sequence, so it will not loop through 1-255 as intended.
The `for /L %V in (1 1 254)` construct generates a numeric sequence from 1 to 254 stepping by 1, the `-n 1` flag limits each ping to a single packet for speed, and piping to `FIND /I "Reply"` filters output to only show live hosts - making this a complete and functional ping sweep using only built-in Windows tools.
Concept tested: Windows native ping sweep of Class C network
Source: https://learn.microsoft.com/en-us/windows-server/administration/windows-commands/for
Topics
Community Discussion
No community discussion yet for this question.