nerdexam
EC-Council

312-50V9 · Question #106

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 Windows FOR /L command with a FIND filter is the correct native syntax to iterate over all 254 usable host addresses in a Class C subnet and report only live systems.

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

(30 responses)
  • A
    10% (3)
  • B
    17% (5)
  • C
    3% (1)
  • D
    70% (21)

Why each option

The Windows FOR /L command with a FIND filter is the correct native syntax to iterate over all 254 usable host addresses in a Class C subnet and report only live systems.

Aping 192.168.2.

ping 192.168.2. is syntactically invalid - the ping command requires a complete IP address or hostname and will fail to execute.

Bping 192.168.2.255

ping 192.168.2.255 sends a single ICMP packet to the subnet broadcast address, which does not individually probe or enumerate each host in the range.

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

The syntax 'for %V in (1 1 255)' uses the file-set form of the FOR loop, not the /L counter form, so it would not iterate numerically from 1 to 255 as intended and would also include address .255 which is the broadcast address.

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

The 'for /L %V in (1 1 254) do' construct uses the Windows FOR loop with the /L (list) switch to iterate a counter from 1 to 254 in steps of 1, covering all valid host addresses in a /24 network. The '-n 1' flag limits each ping to a single ICMP echo request for speed, and piping through 'FIND /I "Reply"' filters output to show only hosts that responded, making it an effective ping sweep using only built-in Windows tools.

Concept tested: Windows FOR /L loop ping sweep enumeration

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

Topics

#ping sweep#ICMP#Windows CLI#network enumeration

Community Discussion

No community discussion yet for this question.

Full 312-50V9 Practice