Hi,
Im trying to write a telnet client that will telnet to a switch in ruby.
the code im using is:
localhost = Net::Telnet::new(“Host” => “10.76.151.193”,
“Timeout” => 10,
“Prompt” => /[#>:]/n) { |resp| print
"==> "+resp }
# pass username and password as commands not .login method
localhost.cmd(“myUsername”) { |c| print c }
localhost.cmd(“myPassword”) { |c| print c }
localhost.cmd(“terminal length 0”) { |c| print c}
@response = ‘’
localhost.cmd(“show interfaces”) { |c| print c; @response += c }
localhost.close
what api i need to download for running this program and where should i
save it??
this program is currently not running properly!
thanks in advance!
Supriya A. wrote:
Hi,
Im trying to write a telnet client that will telnet to a switch in ruby.
the code im using is:
localhost = Net::Telnet::new(“Host” => “10.76.151.193”,
“Timeout” => 10,
“Prompt” => /[#>:]/n) { |resp| print
"==> "+resp }
# pass username and password as commands not .login method
localhost.cmd(“myUsername”) { |c| print c }
localhost.cmd(“myPassword”) { |c| print c }
localhost.cmd(“terminal length 0”) { |c| print c}
@response = ‘’
localhost.cmd(“show interfaces”) { |c| print c; @response += c }
localhost.close
what api i need to download for running this program and where should i
save it??
this program is currently not running properly!
thanks in advance!
Hi Supriya A.,
I am using Ruby-186-26 an older stable version from what i gather I am
super new to ruby but I was looking to do what your script did and it
worked for me my script was a little different but yours did the trick.
Here is the link to get the version that I am using on Windows
Ruby 1.8.6-p26 (Final) is the name. Hope this helps.
Mike