nerdexam
EC-Council

312-50V11 · 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 listens on UDP port 55555 and serves the contents of /etc/passwd to any client that connects to it.

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

(38 responses)
  • A
    11% (4)
  • B
    3% (1)
  • C
    82% (31)
  • D
    5% (2)

Why each option

This netcat command listens on UDP port 55555 and serves the contents of /etc/passwd to any client that connects to it.

Alogs the incoming connections to /etc/passwd file

The `<` operator redirects /etc/passwd as input to netcat, not as an output log destination; logging to a file would require `>` or `>>` redirection.

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

The file is not 'loaded to' the port in a storage sense; it is streamed to a connecting client as output, which is a client-pull operation not a port-storage operation.

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

The flags break down as follows: `-l` puts netcat into listen mode, `-u` specifies UDP transport, and `-p55555` binds to port 55555. The shell redirection `< /etc/passwd` feeds the file contents as standard input to the netcat process. When a remote client connects to UDP port 55555, netcat transmits the contents of /etc/passwd to that client, effectively allowing the connecting party to grab the file over the network.

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

No part of the command performs a delete operation; the file is only read as input and transmitted, leaving it untouched on disk.

Concept tested: Netcat command flags and file exfiltration over UDP

Source: https://man7.org/linux/man-pages/man1/ncat.1.html

Topics

#netcat#UDP#file transfer#command syntax

Community Discussion

No community discussion yet for this question.

Full 312-50V11 Practice