nerdexam
EC-Council

312-50V10 · Question #86

What does the following command in netcat do? nc -l -u -p55555 < /etc/passwd

The correct answer is C. grabs the /etc/passwd file when connected to UDP port 55555. This netcat command sets up a UDP listener on port 55555 and pipes /etc/passwd as input, so any client connecting to that port receives the file contents. The correct answer describes what happens from the connecting client's perspective.

System Hacking

Question

What does the following command in netcat do? nc -l -u -p55555 < /etc/passwd

Options

  • Alogs the incoming connections to /etc/passwd file
  • Bloads the /etc/passwd file to the UDP port 55555
  • Cgrabs the /etc/passwd file when connected to UDP port 55555
  • Ddeletes the /etc/passwd file when connected to the UDP port 55555

How the community answered

(62 responses)
  • A
    3% (2)
  • B
    6% (4)
  • C
    77% (48)
  • D
    13% (8)

Why each option

This netcat command sets up a UDP listener on port 55555 and pipes /etc/passwd as input, so any client connecting to that port receives the file contents. The correct answer describes what happens from the connecting client's perspective.

Alogs the incoming connections to /etc/passwd file

The redirection operator '<' feeds /etc/passwd as input to netcat, it does not write output to the file - logging would require the '>' or '>>' operators.

Bloads the /etc/passwd file to the UDP port 55555

The file is not statically loaded to the port at bind time - it is streamed to a client only when an active connection is established to that port.

Cgrabs the /etc/passwd file when connected to UDP port 55555Correct

The flags -l (listen), -u (UDP), and -p55555 (bind to port 55555) create a UDP server, and the input redirection '< /etc/passwd' causes netcat to feed the file contents into the connection - meaning a connecting client receives (grabs) the /etc/passwd file data.

Ddeletes the /etc/passwd file when connected to the UDP port 55555

There is no delete operation in this command - netcat is only reading and transmitting the file contents, leaving the file on disk untouched.

Concept tested: Netcat UDP listener with file redirection

Topics

#netcat#UDP#file transfer#passwd file

Community Discussion

No community discussion yet for this question.

Full 312-50V10 Practice