如何使用 telnet 从远程嵌入式系统中获取二进制文件? [英] How to fetch a binary file from a remote embeded system using telnet?

查看:31
本文介绍了如何使用 telnet 从远程嵌入式系统中获取二进制文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个远程嵌入式系统,它可以远程登录.如何使用 ruby​​ 从中获取二进制文件?如果它是一个文本文件,我可以使用:

I have a remote embedded system and it is telnet-able. How can I fetch a binary file from it using ruby? If it were a text file, I could have used:

  con = Net::Telnet::new("Host"=>ip,"Timeout"=>200)  #Host not host
  File.open("fetched_file","w+") do |f|
        con.cmd("cat /ect/file")  {|data| f.write(data)}
  end

但这不适用于二进制文件,您将无法通过 cat 获取所需的数据.

But this wouldn't work for binary file you won't get desirable data by cating it.

推荐答案

然后建立您的 telnet 连接
发送命令:

establish your telnet connection then
send the command:

uuencode filename -

到远程主机,用文件名替换文件名

to the remote host, replacing filename with the filename

获取您发送的数据并将其传递给系统上的uudecode

take the data you are sent and pass it to uudecode on your system

这篇关于如何使用 telnet 从远程嵌入式系统中获取二进制文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆