From: Cliff Rosson Date: 2013-05-08T04:01:26+09:00 Subject: Re: Telnet to a cisco switch --047d7b15ac31dbbc1604dc256ffa Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable You need to set a prompt. This is what I use to automate my cisco/f5 stuff. Feel free to use it. https://gist.github.com/crosson/5535173 On Tue, May 7, 2013 at 11:38 AM, Rud=E1 G. wrote: > I'm trying to connect to a Cisco Switch and execute a few commands. The > problem is that it's executing only the first telnet.cmd(). To execute > anything else I need to append some command at the end of the first > cmd() (separated by \n). Here is my code: > > telnet =3D Net::Telnet::new("Host" =3D> CISCO, > "Timeout" =3D> 10) > telnet.cmd("#{USER}\n#{PASS}") { |c| print c } #works fine > telnet.cmd("help") { |c| print c } #nothing happens > > > The second cmd() is not working. How do I fix this? > > -- > Posted via http://www.ruby-forum.com/. > > --=20 vizualize.me/cliffrosson --047d7b15ac31dbbc1604dc256ffa Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable
You need to set a prompt. This is what I use to automate m= y cisco/f5 stuff. Feel free to use it.

https://gist.github.com/crosson/5535173<= /a>


O= n Tue, May 7, 2013 at 11:38 AM, Rud=E1 G. <lists@ruby-forum.com>= wrote:
I'm trying to connect to a Cisco Switch = and execute a few commands. The
problem is that it's executing only the first telnet.cmd(). To execute<= br> anything else I need to append some command at the end of the first
cmd() (separated by \n). Here is my code:

telnet =3D Net::Telnet::new("Host" =3D> CISCO,
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 "Timeout" =3D= > 10)
telnet.cmd("#{USER}\n#{PASS}") { |c| print c } #works fine
telnet.cmd("help") { |c| print c } #nothing happens


The second cmd() is not working. How do I fix this?

--
Posted via http://= www.ruby-forum.com/.




--
vizual= ize.me/cliffrosson
--047d7b15ac31dbbc1604dc256ffa--