linux nc command

linux nc 命令

Netcat 是一款简单的Unix工具,使用UDP和TCP协议。 它是一个可靠的容易被其他程序所启用的后台操作工具。 使用它你可以轻易的建立任何连接。内建有很多实用的工具。

netcat 安装

1
2
3
4
# ubuntu 18.04
sudo apt install netcat
# centos 7
sudo yum install nc

应用案例

  • 端口扫描
1
nc -z -v  10.10.0.103 3389  #查看主机3389端口是否启用

回显示例:

1
2
3
4
5
6
# 3389端口
Connection to 10.10.0.103 3389 port [tcp/*] succeeded!
# 80端口
Connection to 10.10.0.103 80 port [tcp/http] succeeded!
# 22端口
Connection to 10.10.0.100 22 port [tcp/ssh] succeeded!

无回显,则端口无法通信。默认TCP,-u参数可调整为UDP模式。

端口扫描案例:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
For example:

$ nc -zv host.example.com 20-30
Connection to host.example.com 22 port [tcp/ssh] succeeded!
Connection to host.example.com 25 port [tcp/smtp] succeeded!

The port range was specified to limit the search to ports 20 - 30, and is
scanned by increasing order.

You can also specify a list of ports to scan, for example:

$ nc -zv host.example.com 80 20 22
nc: connect to host.example.com 80 (tcp) failed: Connection refused
nc: connect to host.example.com 20 (tcp) failed: Connection refused
Connection to host.example.com port [tcp/ssh] succeeded!

The ports are scanned by the order you given.

linux nc command
https://ywmy.xyz/2019/11/30/linux-nc-command/
作者
ian
发布于
2019年11月30日
许可协议