Linux nc command
Linux nc command is used to set up the router.
The implementation of this directive may set the parameters of the router.
grammar
nc [-hlnruz][-g<网关...>][-G<指向器数目>][-i<延迟秒数>][-o<输出文件>][-p<通信端口>][-s<来源位址>][-v...][-w<超时秒数>][主机名称][通信端口...]
Parameter Description:
- -g <gateway> Set the router-hop communication gateways, you can set the throw oh eight.
- -G <Point number> Settings Source routing point is, its value as a multiple of four.
- -h online help.
- -i <delay in seconds> Set the time interval to transmit information and scan communication ports.
- -l use a listening mode, control incoming data.
- -n direct use of IP addresses, rather than through the domain name server.
- -o <output file> specify the file name, the data transmission between the hexadecimal character code into the dump file is saved.
- -p <communications port> Set the communications port on the local host.
- -r random number to specify the local and remote host communication port.
- -s <source address> Set the local IP address of the host sending the packet.
- -u Use UDP transport protocol.
- -v display process execution instruction.
- -w <timeout in seconds> Set the time to wait for connection.
- -z 0 Use input / output mode, used only when scan communication ports.
Examples
TCP port scan
# 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 192.168.0.3 port range 1-100
UDP port scan
# 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 //用户输入