a.端口扫描[root@BlackGhost zhangy]# nc -v -w 2 192.168.1.34 -z 21-24
nc: connect to 192.168.2.34 port 21 (tcp) failed: Connection refused
Connection to 192.168.2.34 22 port [tcp/ssh] succeeded!
nc: connect to 192.168.2.34 port 23 (tcp) failed: Connection refused
nc: connect to 192.168.2.34 port 24 (tcp) failed: Connection refused
b.传文件[root@BlackGhost zhangy]# nc -l 1234 > test.txt #192.168.1.10
[root@ubuntu zhangy]# nc 192.168.2.34 < test.txt #192.168.1.11
c.简单聊天工具[root@BlackGhost zhangy]# nc -l 1234 #192.168.1.10 开启端口
[root@ubuntu zhangy]# nc 192.168.2.34 1234 #192.168.1.11连接端口
d.建立从本地1234端口到host.example.com的80端口连接,5秒超时[root@BlackGhost zhangy]# nc -p 1234 -w 5 blog.51yip.com 80
e.u为UDP连接[root@BlackGhost zhangy]# nc -u 192.168.1.102 53
f.模拟HTTP Headers[root@BlackGhost zhangy]# nc blog.51yip.com 80