nerdexam
GIAC

GPEN · Question #486

You want to find out what ports a system is listening on. What Is the correct command on a Linux system?

The correct answer is A. netstat nap. On Linux, netstat with the correct flags displays all active sockets and listening ports along with the associated process information.

Penetration Testing Foundations & Reconnaissance

Question

You want to find out what ports a system is listening on. What Is the correct command on a Linux system?

Options

  • Anetstat nap
  • Bf port/p
  • Ctasklist/v
  • DIsof -nao

How the community answered

(28 responses)
  • A
    82% (23)
  • B
    11% (3)
  • C
    4% (1)
  • D
    4% (1)

Why each option

On Linux, netstat with the correct flags displays all active sockets and listening ports along with the associated process information.

Anetstat napCorrect

The command 'netstat -nap' uses -n to display addresses and ports numerically without DNS resolution, -a to include all sockets including those in a listening state, and -p to show the process name and PID associated with each socket. This combination provides a complete listing of all ports the system is listening on and which processes own them, making it the standard Linux utility for this specific task.

Bf port/p

'f port/p' is not a valid Linux command or utility and does not correspond to any standard network diagnostic tool available on Linux systems.

Ctasklist/v

'tasklist /v' is a Windows command-line tool that lists running processes with verbose output - it does not exist on Linux and does not report network socket or port information.

DIsof -nao

'lsof -nao' uses an incorrect flag combination for enumerating listening ports - while lsof can show network sockets via 'lsof -i', the -o flag shows file offsets and this syntax does not produce a useful or complete port listing.

Concept tested: Linux netstat flags for enumerating listening ports

Source: https://linux.die.net/man/8/netstat

Topics

#netstat#Linux commands#port enumeration#open ports

Community Discussion

No community discussion yet for this question.

Full GPEN Practice