Posts Tagged ‘netcat’

December 11, 2011

  甚至可以可以使用nc建立文件的中转站。比如,从host1无法直连到host3,只能先连到host2再间接连到host3。如果想从host1向host3传输文件,可以在host2上面建立中转。每次直接传输是client/server还是server/client,都可以实现(当然,如果两台机器有防火墙相隔时,就另说了):

1
2
3
4
dutor@host2 $ nc -l 5198 | nc -l 5191
dutor@host2 $ # 使用 while true; do nc -l 5198 | nc -l 5191; done 可以建立持久的'中转站'
dutor@host1 $ nc host2 5198 < stuff.tgz
dutor@host3 $ nc host2 5191 | tar xzvf -

  nc是一个简单,强大,又可以信手拈来的工具,尽情发挥你的想象力吧。

Tags: ,. 121 views
Page 1 of 11