GCIH · Question #641
Which of the following netcat commands will connect to tcp port 2222 on a remote system (10.0.0.1)?
The correct answer is A. C:\>nc.exe 10.0.0.1 2222. The basic netcat syntax to initiate an outbound TCP connection is 'nc <host> <port>' with no additional flags. Flags like -l and -L put netcat into listen mode instead of connect mode.
Question
Which of the following netcat commands will connect to tcp port 2222 on a remote system (10.0.0.1)?
Options
- AC:>nc.exe 10.0.0.1 2222
- BC:>nc.exe 10.0.0.1 -l -p 2222
- CC:>nc.exe 10.0.0.1 -L 2222
- DC:>nc.exe 10.0.0.1 -p 2222
How the community answered
(70 responses)- A89% (62)
- B4% (3)
- C6% (4)
- D1% (1)
Why each option
The basic netcat syntax to initiate an outbound TCP connection is 'nc <host> <port>' with no additional flags. Flags like -l and -L put netcat into listen mode instead of connect mode.
The command 'nc.exe 10.0.0.1 2222' uses the correct netcat client syntax - specifying the target host followed by the destination port number initiates an outbound TCP connection to port 2222 on 10.0.0.1 with no additional flags required.
The -l flag places netcat in listen (server) mode, so this command would attempt to bind and listen locally rather than connect outbound to the remote host.
The -L flag (uppercase) in some netcat variants sets a persistent listen mode, not an outbound connection mode.
The -p flag specifies the local source port to bind to on the client side, not the destination port, so this command does not correctly specify a remote destination port.
Concept tested: Netcat client syntax for outbound TCP connections
Source: https://nmap.org/ncat/guide/ncat-man.html
Topics
Community Discussion
No community discussion yet for this question.