- 论坛徽章:
- 0
|
一个更有用的轻量级工具,nc的另一个强大的功能---文件传输。
AME
nc - arbitrary TCP and UDP connections and listens
SYNOPSIS
nc [-46DdhklnrStUuvz] [-i interval] [-p source_port] [-s source_ip_address] [-T ToS] [-w timeout] [-X proxy_protocol] [-x proxy_address[:port]] [hostname] [port]
譬如目的主机:192.168.0.1 源主机:192.168.0.2
目的主机监听
nc -l 监听端口 > 要接收的文件名
nc -l 5000 > /tmp/test.out
# netstat -tpln
tcp 0 0 0.0.0.0:5000 0.0.0.0:* LISTEN 18166/nc
打开防火墙tcp 5000端口:
iptables -I RH-Firewall-1-INPUT 8 -p tcp -m tcp --dport 500-j ACCEPT
源主机发起请求
nc 目的主机ip 目的端口 /tmp/test.out
源主机发起请求
#nc -u 192.168.0.1 5000 filename.out
Using a second machine, connect to the listening nc process, feeding it the file which is to be transferred:
$ nc host.example.com 1234 < filename.in
本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u3/93182/showart_1967524.html |
|