I'm trying to connect to a Cisco Switch with SSH and ruby. The problem is that I need to enter an empty 'login as' then it will ask me for an User Name and Password. On Putty I do like this:
Here is how i have tried to connect with NET::SSH.
CISCO = "host" #Enter the IP address here
USER = "operacao" #Enter username here
PASS = "" #Enter password here
tn = Net::SSH::Telnet::new("Host" => CISCO, "Timeout" => 60, "Prompt" => /^\login as:/ )
tn.cmd("\n") { |c| print c }
tn.cmd("\n#{USER}") { |c| print c }
tn.cmd(PASS) { |c| print c }
tn.print("echo oi") { |c| print c }
tn.close
Is there any way to do this with Ruby?