From: Cliff Rosson Date: 2013-08-08T09:19:54-07:00 Subject: Re: net/telnet haning on pasword --047d7b675b544a736004e3720741 Content-Type: text/plain; charset=ISO-8859-1 Is the prompt "Username" correct? It seems like its getting stuck there not recieving the value you told it to expect. Make sure your prompt matches. IMHO consider switching to SSH. I have found it just easier to work in. You still need to set the proper prompt. This is what mine looks like. https://github.com/crosson/ssh/blob/master/ssh.rb creds[:prompt] = /.*>|.*#/ On Thu, Aug 8, 2013 at 3:22 AM, Avery Rozar wrote: > Hello all, > I'm getting stuck at the @password portion. This script will get into > the Cisco ASA, but doesn't seem to enter in the password. Any help is > greatly appreciated. > > begin > session = Net::Telnet::new('Host' => @hostname, 'Timeout' => 10, > 'Telnetmode' => false, verbose: :debug) > session.waitfor('Prompt' => /Username/) > session.cmd(@username) { |c| print c } > session.waitfor('Prompt' => /Password/) > session.cmd(@password) { |c| print c } > session.waitfor(/>/) > session.cmd(@cmd + '\n') { |c| print c } > session.close > > end > > > Debug output: > > arozar > Password: Uncaught exception: timed out while waiting for more data > > /Users/averyrozar/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/net/telnet.rb:558:in > `waitfor' > > /Users/averyrozar/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/net/telnet.rb:695:in > `cmd' > /Users/averyrozar/Ruby-Scripts/tools/telnet-tool.rb:44:in ` (required)>' > > Process finished with exit code 0 > > -- > Posted via http://www.ruby-forum.com/. > -- - Cliff Rosson --047d7b675b544a736004e3720741 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable
Is the prompt "Username" correct? It seems like = its getting stuck there not recieving the value you told it to expect.
=
Make sure your prompt matches.

IMHO= consider switching to SSH. I have found it just easier to work in. You sti= ll need to set the proper prompt. This is what mine looks like.

https://github.com/crosson/ssh/blob/master/ssh.rb
=
creds[:prompt] =3D

O= n Thu, Aug 8, 2013 at 3:22 AM, Avery Rozar <lists@ruby-forum.com>= ; wrote:
Hello all,
I'm getting stuck at the @password portion. This script will get into the Cisco ASA, but doesn't seem to enter in the password. Any help is greatly appreciated.

begin
=A0 session =3D Net::Telnet::new('Host' =3D> @hostname, 'Tim= eout' =3D> 10,
'Telnetmode' =3D> false, verbose: :debug)
=A0 session.waitfor('Prompt' =3D> /Username/)
=A0 session.cmd(@username) { |c| print c }
=A0 session.waitfor('Prompt' =3D> /Password/)
=A0 session.cmd(@password) { |c| print c }
=A0 session.waitfor(/>/)
=A0 session.cmd(@cmd + '\n') { |c| print c }
=A0 session.close

end


Debug output:

arozar
Password: Uncaught exception: timed out while waiting for more data
=A0 /Users/averyrozar/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/net/telnet.r= b:558:in
`waitfor'
=A0 /Users/averyrozar/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/net/telnet.r= b:695:in
`cmd'
=A0 /Users/averyrozar/Ruby-Scripts/tools/telnet-tool.rb:44:in `<top
(required)>'

Process finished with exit code 0

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



--
- Cliff Rosson
--047d7b675b544a736004e3720741--