Is there a way to copy a file over telnet

被刻印的时光 ゝ 提交于 2019-12-12 02:02:51

问题


preferably using 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.


回答1:


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.




回答2:


How about using scp?

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


来源:https://stackoverflow.com/questions/6422148/is-there-a-way-to-copy-a-file-over-telnet

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!