nerdexam
EC-Council

312-50V11 · 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 for /L loop combined with PING and FIND is the correct native Windows command syntax to perform a ping sweep across all 254 usable hosts in a Class C subnet.

Scanning Networks

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

(50 responses)
  • A
    8% (4)
  • B
    4% (2)
  • C
    16% (8)
  • D
    72% (36)

Why each option

The for /L loop combined with PING and FIND is the correct native Windows command syntax to perform a ping sweep across all 254 usable hosts in a Class C subnet.

Aping 192.168.2.

`ping 192.168.2.` is syntactically incomplete and does not resolve to a valid IP address, so the command will fail without pinging any host.

Bping 192.168.2.255

`ping 192.168.2.255` targets only the directed broadcast address of the subnet and does not send ICMP requests to individual hosts; most modern operating systems also ignore or drop broadcast pings.

Cfor %V in (1 1 255) do PING 192.168.2.%V

`for %V in (1 1 255) do PING 192.168.2.%V` omits the required /L flag, so the for loop treats the parenthesized values as a file set rather than a numeric range and will not iterate through host addresses correctly.

Dfor /L %V in (1 1 254) do PING -n 1 192.168.2.%V | FIND /I "Reply"Correct

The command `for /L %V in (1 1 254) do PING -n 1 192.168.2.%V | FIND /I "Reply"` uses the Windows for /L construct to iterate numerically from 1 to 254 in steps of 1, covering all valid host addresses in a Class C network. The -n 1 flag limits each ping to a single ICMP echo request for speed, and piping to FIND /I "Reply" filters output to show only hosts that responded. This entire workflow relies solely on built-in Windows tools with no third-party dependencies.

Concept tested: Native Windows ICMP ping sweep with for /L loop

Source: https://learn.microsoft.com/en-us/windows-server/administration/windows-commands/for

Topics

#ping sweep#ICMP host discovery#Windows CLI#class C enumeration

Community Discussion

No community discussion yet for this question.

Full 312-50V11 Practice