nc命令可用于发送任务tcp/udp连接和监听.
官方描述的主要功能包括:
下面看看官方的几个例子:
在A机器运行(假设A机器主机名为node1
:
nc -l 1234 # -l表示监听
在B机器运行:
nc node1 1234
此时从A或者B机器输入任何信息,都会在对方的机器中回显,实现了简单的即时聊天工具.
假设B机器有一个文件data.txt,需要传输到A机器:
在A机器:
nc -l 1234 >data.txt # data.txt需要保存的目标文件名
在B机器:
nc node1 1234 <data.txt # data.txt需要传输的文件
假设B需要远程操作A,又没有安装ssh:
在A机器:
rm -f /tmp/f; mkfifo /tmp/f
cat /tmp/f | /bin/sh -i 2>&1 | nc -l 127.0.0.1 1234 > /tmp/f
在B机器:
nc node1 1234
echo "GET / HTTP/1.0\r\n\r\n" | nc localhost 80
# 查看主机名为node1的80端口是否开放
nc -zv node1 80
# 扫描主机名为node1的1~1024哪些端口是开放的
nc -zc node1 1-1024
2023年2月01日 19:27
The nc command is a powerful tool for networking, and with several official Demo instances available, users can explore the capabilities of this command with buy cheap diamond rings ease. This makes it easier for users to understand the various options and take advantage of its full potential. Whether you are a novice or an experienced user, these Demo instances offer an invaluable resource for gaining a greater knowledge of this command.
2023年9月22日 23:24
Subjects: Photography encompasses a vast array of subjects, including but not limited to christmas mini session
2024年8月24日 01:15
This content is simply exciting and creative. I have been deciding on a institutional move and this has helped me with one aspect. Kissimmee Bed Bug Treatment
2024年8月24日 01:15
On this subject internet page, you'll see my best information, be sure to look over this level of detail. Orlando Termite Treatment
2024年8月24日 01:16
These websites are really needed, you can learn a lot. Oviedo Termite Treatment
2024年8月24日 01:16
Thanks for writing such a good article, I stumbled onto your blog and read a few post. I like your style of writing... Deltona Pest Control
2024年10月10日 15:20
It is rather very good, nevertheless glance at the data with this handle. Tax preparation services
2024年10月13日 21:59
It is rather very good, nevertheless glance at the data with this handle. buy instagram likes
2024年10月16日 21:31
I invite you to the page where see how much we have in common. اقفال الكترونية