How to ssh and then telnet with ruby? -
i need retrieve information networks terminals using telnet. terminals in network, cannot access network. can access server in same network, , telnet there.
the case here, i´m doing ruby. can run ruby , program in computer outside network. start coding connect via ssh server, , telnet terminals , information. uses several libraries trying this, net-ssh, net-ssh-bash, , net/ssh/telnet, because think there best.
require 'net/ssh/telnet' s = net::ssh::telnet.new( "dump_log" => "/logtelnet", "host" => "9.0.0.2", "username" => "root", "password" => "toor" ) while 1>0 comando = gets.chomp puts s.cmd(comando) end
i can connect server, , can run commands, "ls", "cd /" etc.
but, when try telnet or ssh network terminals session gets frozen. cannot pipe telnet stream ssh output program.
any idea solve this?
Comments
Post a Comment