Even I tried using login once but timed out for reasons unknown, despite the fact that mine has a valid password too....and then replaced it with print/waitfor combination...now it works fine....any reason why login fails??
----- Original Message ----- From: <[EMAIL PROTECTED]> To: "K Old" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> Sent: Wednesday, July 30, 2003 12:19 AM Subject: RE: Net::Telnet with username, no password - can't get past "password" prompt > ------------------------------------------------ > On 29 Jul 2003 11:06:09 -0400, K Old <[EMAIL PROTECTED]> wrote: > > > Hello everyone, > > > > I'm trying to use Net::Telnet to connect to a server that has a test > > account called (appropriately) TEST. It has no password on doing a > > normal telnet to the server after supplying the username, I am taken to > > the shell rather than being prompted for my password. > > > > The prompt I'm given is: > > > > TEST F50:/genii4 $ > > > > Heres's the script I wrote: > > > > #!/usr/bin/perl -w > > # > > use strict; > > use Net::Telnet(); > > > > my $host = "172.16.1.2"; > > my $user = "TEST"; > > my $pass = ""; > > > > my $t = new Net::Telnet(Timeout => 30, Dump_Log => "/tmp/log-dump"); > > $t->open("$host"); > > $t->login(Name => $user, Password => $pass); > > $t->waitfor('/.*genii4.*\$$/'); > > $t->print('cd $GENSRC'); > > $t->cmd('cd g2oesrc'); > > my @pwd = $t->cmd("pwd"); > > print @pwd; > > $t->close(); > > > > >From the docs for Net::Telnet: > > "Use a combination of print() and waitfor() as an alternative to login() or cmd() when they don't do what you want." > > It appears that 'login' requires both a username and password to be asked for otherwise it will timeout, because your case is special (aka no password prompt) you will probably need to mimic the behavior with 'print/waitfor'. > > > > This is what's in the log-dump file: > > > > <snip> log dump > > > > > > > The error I get from Net::Telnet is: > > > > timed-out waiting for password prompt at ./telnet.pl line 12 > > > > Can anyone offer any ideas how I can get around this. Don't worry about > > security issues, it's an internal box and nothing important is on it, I > > just need to test this as the TEST user. > > > > I've also tried to set the Prompt parameter when initializing the object > > like so: > > my $t = new Net::Telnet(Timeout => 30, > > Dump_Log => "/tmp/log-dump", > > Prompt => '/genii4 ?$/i'); > > > > > > Still no luck. > > > > Any help is appreciated... > > > > Check the docs again specifically the section on "What To Know Before Using" and the 'login' method... > > http://danconia.org > > -- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]