NC(netcat)应用全记录



1. 连接tianya.cn(MIME欺骗)
$ nc -nvv 221.11.172.178 80
Connection to 221.11.172.178 80 port [tcp/*] succeeded!
get / http/1.1
HTTP/1.0 400 Bad request
Cache-Control: no-cache
Connection: close
Content-Type: text/html


400 Bad request


Your browser sent an invalid request.



2. 聊天:
服务器端:
$ nc -l 1234
ddd
sss
xxxxx
客户端:
$ nc 127.0.0.1 1234
ddd
sss
xxxxx

$ nc  192.168.1.255 1234  ---- 局域网广播消息


3. 端口扫描:
$ nc -nvv -w2 192.168.1.1 80-90
Connection to 192.168.1.1 80 port [tcp/*] succeeded!
nc: connect to 192.168.1.1 port 81 (tcp) failed: Connection refused
nc: connect to 192.168.1.1 port 82 (tcp) failed: Connection timed out


4. 传输文件:
服务器端:
$ nc -lvv 1234 > test.txt
客户端:
$ nc 127.0.0.1 1234 < test.txt

test.txt传输完成。








你可能感兴趣的:(4.----网络协议)