GCIH · Question #734
Which netcat command will listen on port 2222 for connections from a remote system (10.0.0.1)?
The correct answer is D. C:\>nc.exe -1-p 2222. The netcat -l flag activates listen mode and -p specifies the port number, making nc.exe -l -p 2222 the correct command to open a listener on port 2222.
Question
Which netcat command will listen on port 2222 for connections from a remote system (10.0.0.1)?
Options
- AC:>nc.exe > p 2222
- BC:>nc.exe 10.0.0.1 2222
- CC:>nc.exe -z -p 10.0.0.1 2222
- DC:>nc.exe -1-p 2222
How the community answered
(22 responses)- A5% (1)
- B5% (1)
- D91% (20)
Why each option
The netcat -l flag activates listen mode and -p specifies the port number, making nc.exe -l -p 2222 the correct command to open a listener on port 2222.
The > character is a shell output redirection operator, not a netcat flag; this command would attempt to redirect output to a file named 'p' rather than configuring any listening behavior.
Providing nc.exe with an IP address and port in client mode (nc.exe 10.0.0.1 2222) initiates an outbound connection to a remote host - it does not create a local listener.
The -z flag enables zero-I/O scan mode, which is used for port scanning to check if ports are open without sending data, not for establishing a persistent listener.
The nc.exe -l -p 2222 command uses -l to place netcat into server listen mode, causing it to wait passively for an inbound connection rather than initiating one. The -p flag designates port 2222 as the listening port, which is the standard Windows netcat syntax for hosting an inbound connection.
Concept tested: Netcat listen mode syntax with -l and -p flags
Source: https://nmap.org/ncat/guide/ncat-usage.html
Topics
Community Discussion
No community discussion yet for this question.