nerdexam
EC-Council

312-50V11 · Question #313

What is the outcome of the comm"nc -l -p 2222 | nc 10.1.0.43 1234"?

The correct answer is B. Netcat will listen on port 2222 and output anything received to a remote connection on 10.1.0.43. The piped netcat command creates a relay: the first nc listens on port 2222 and forwards all received data to a remote host via the second nc instance.

Scanning Networks

Question

What is the outcome of the comm"nc -l -p 2222 | nc 10.1.0.43 1234"?

Options

  • ANetcat will listen on the 10.1.0.43 interface for 1234 seconds on port 2222.
  • BNetcat will listen on port 2222 and output anything received to a remote connection on 10.1.0.43
  • CNetcat will listen for a connection from 10.1.0.43 on port 1234 and output anything received to
  • DNetcat will listen on port 2222 and then output anything received to local interface 10.1.0.43.

How the community answered

(32 responses)
  • A
    13% (4)
  • B
    78% (25)
  • C
    6% (2)
  • D
    3% (1)

Why each option

The piped netcat command creates a relay: the first nc listens on port 2222 and forwards all received data to a remote host via the second nc instance.

ANetcat will listen on the 10.1.0.43 interface for 1234 seconds on port 2222.

Netcat does not use an IP address as a listening interface in this syntax, and '1234' is a port number not a duration in seconds.

BNetcat will listen on port 2222 and output anything received to a remote connection on 10.1.0.43Correct

In this command, 'nc -l -p 2222' listens on port 2222 for incoming connections, and the pipe operator passes any received data as stdin to 'nc 10.1.0.43 1234', which opens an outbound connection to host 10.1.0.43 on port 1234. This creates a one-way data relay from the listening port to the remote destination, commonly used in port forwarding and pivoting scenarios.

CNetcat will listen for a connection from 10.1.0.43 on port 1234 and output anything received to

The '-l -p 2222' flags specify a listening port of 2222, not a connection from a specific remote IP; the second nc argument specifies the destination, not a source filter.

DNetcat will listen on port 2222 and then output anything received to local interface 10.1.0.43.

10.1.0.43 is the destination of the second nc instance (a remote host), not a local interface; the data is forwarded outbound to that remote address.

Concept tested: Netcat pipe relay for port forwarding

Source: https://nmap.org/ncat/guide/ncat-usage.html

Topics

#netcat#port forwarding#traffic relay#network relay

Community Discussion

No community discussion yet for this question.

Full 312-50V11 Practice