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