nerdexam
CompTIA

PT0-001 · Question #155

A penetration tester has compromised a host. Which of the following would be the correct syntax to create a Netcat listener on the device?

The correct answer is A. nc -lvp 4444 /bin/bash. Creating a Netcat listener requires the -l (listen), -v (verbose), and -p (port) flags combined in a single command to correctly bind and await incoming connections on a specified port.

Post-exploitation and lateral movement

Question

A penetration tester has compromised a host. Which of the following would be the correct syntax to create a Netcat listener on the device?

Options

  • Anc -lvp 4444 /bin/bash
  • Bnc -vp 4444 /bin/bash
  • Cnc -p 4444 /bin/bash
  • Dnc -lp 4444 -e /bin/bash

How the community answered

(38 responses)
  • A
    87% (33)
  • B
    3% (1)
  • C
    3% (1)
  • D
    8% (3)

Why each option

Creating a Netcat listener requires the -l (listen), -v (verbose), and -p (port) flags combined in a single command to correctly bind and await incoming connections on a specified port.

Anc -lvp 4444 /bin/bashCorrect

The command nc -lvp 4444 /bin/bash uses -l to enable listen mode, -v for verbose output, and -p to specify port 4444, which are the three essential flags for establishing a Netcat listener. Together these flags configure Netcat to passively wait for an inbound connection on the designated port rather than initiating an outbound connection.

Bnc -vp 4444 /bin/bash

Option B omits the -l flag, which is required to enable listen mode; without it, Netcat attempts to initiate an outbound connection instead of waiting for an inbound one.

Cnc -p 4444 /bin/bash

Option C omits both the -l flag for listen mode and the -v flag for verbose output, making it unable to function as a listener and providing no connection status feedback.

Dnc -lp 4444 -e /bin/bash

Option D omits the -v (verbose) flag; while -e /bin/bash correctly binds a shell to the connection in some Netcat variants, the missing verbosity flag means the tester loses connection status information, making this an incomplete standard listener syntax.

Concept tested: Netcat listener command syntax and required flags

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

Topics

#Netcat#reverse shell#listener syntax#command execution

Community Discussion

No community discussion yet for this question.

Full PT0-001 Practice