开发者

Is there a way to copy a file over telnet

preferably usin开发者_如何学编程g python or shell. does not have to use telnet program but does need to use protocol since that is the simplest way in my case(no need to install stuff on "server" to transfer files over).

Note this isn't directly connected to the outside world and security isn't a big deal.


If the telnet protocol is all you can use than about the only way I can suggest is to use uuencode on the source side to output the file as regular text to standard output.

Then have your terminal emulator capture the output to a file and use uudecode on your local box to decode it.

The advantage of this is that uudecode is well used to removing cruft from around the outside of encoded documents.

Transcript follows:

pax$ cat qq.c | uuencode qq.c
begin 644 qq.c
m(venxvqux&x@/x-tx&ex+f@^xb-i;f-l=xxe(xqt:xue+f@^xfen=x!mxxen
m*xd@>ph@(xx@:xyt(&d[xbx@(x!t:xuexwx@>xl*(xx@(xxr.ph@(xx@xf]r
m(xai(xt@,xl@:xx\(x$p,xxp,xxp.r!i*rlixbx@(xx@(xx@>xx](&=e=&xa
h=&x@*x(r,x$q,xxq,x$p,c@p,x(i.ph@(xx@<fxt=x)n(xx[xgt*x@xx
x
end

pax$ ( echo carp ; cat qq.c | uuencode newqq.c ; echo more carp ) | uudecode

pax$ diff qq.c newqq.c

pax$ _

You can see that the file is successfully extracted even with the presence of a certain type of fish (I didn't want to take the chance of offending anyone) in the output stream - uudecode safely ignores this since it's not relevant to the file.


How about using scp?

scp someuser@somehost.somedomain.com:/path/to/file :.
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜