Shea Martin
3/15/2006 2:49:00 PM
I am having problems with the Telnet module.
Here is my test script:
<code>
#!/usr/bin/ruby
require 'net/telnet'
tn = Net::Telnet.new( 'Host' => 'matilda', 'Telnetmode'=>true,
'Prompt' => '$' ) { |s| puts s }
tn.login('sheam', 'my_pass') { |s| puts s }
puts ">>>LOGIN COMPLETE"
tn.cmd( 'ls -l' ) { |s| puts s }
tc.close
exit 0
</code>
If I run this to a solaris telnet server (from a linux box), I get the
greeting message and a prompt (not my specified prompt, but that is ok).
But my command is never executed, and a timeout occurs. I do not get
the '>>>LOGIN COMPLETE' message.
If I run this to a WinXP telnet server (from a XP box), I get this:
<output>
Trying fifastbuild1...
Connected to fifastbuild1.
Welcome to Microsoft Telnet Service
login:
Testing
password:
</output>
Then, a timeout. It appears that my password is not actually being sent?
Ultimately it is the WinXP server that I want to connect to. I was
just fooling with my solaris and linux box for further testing.
I tried chaning the login line to tn.login('user'), followed by a
tn.puts('password'), but it still did not get past the tn.login() line.
Thanks,
~S