Linux nc Command
The Linux nc command is used to set up routers.
Executing this command can set the related parameters of the router.
Syntax
nc [-hlnruz][-g<网关...>][-G<指向器数目>][-i<延迟秒数>][-o<输出文件>][-p<通信端口>][-s<来源位址>][-v...][-w<超时秒数>][主机名称][通信端口...]
Parameter Description:
- -g<gateway> Set the router hop communication gateway, up to 8 can be set.
- -G<number of pointers> Set the source route pointer, whose value is a multiple of 4.
- -h Online help.
- -i<delay seconds> Set the time interval for sending information and scanning communication ports.
- -l Use listening mode to control incoming data.
- -n Use IP addresses directly, without going through the domain name server.
- -o<output file> Specify the file name, and dump the transmitted data in hexadecimal code into the file for storage.
- -p<communication port> Set the communication port used by the local host.
- -r Randomly specify the communication ports of the local and remote hosts.
- -s<source address> Set the IP address of the data packets sent by the local host.
- -u Use the UDP transmission protocol.
- -v Display the command execution process.
- -w<timeout seconds> Set the time to wait for the connection.
- -z Use 0 input/output mode, only used when scanning communication ports.
Examples
TCP port scanning
# nc -v -z -w2 192.168.0.3 1-100 192.168.0.3: inverse host lookup failed: Unknown host (UNKNOWN) [192.168.0.3] 80 (http) open (UNKNOWN) [192.168.0.3] 23 (telnet) open (UNKNOWN) [192.168.0.3] 22 (ssh) open
Scan port range 1-100 of 192.168.0.3
Scan UDP ports
# nc -u -z -w2 192.168.0.1 1-1000 //扫描192.168.0.3 的端口 范围是 1-1000
Scan the specified port
# nc -nvv 192.168.0.1 80 //扫描 80端口 (UNKNOWN) [192.168.0.1] 80 (?) open y //用户输入Other Extensions
Linux Command Encyclopedia