SSH と Ruby を使用して Cisco スイッチに接続しようとしています。問題は、空の「ログイン名」を入力する必要があることです。その後、ユーザー名とパスワードの入力を求められます。Putty では、次のようにします。
これが私が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
Rubyでこれを行う方法はありますか?