Net::Telnet, wrong prompt, user not needed only password is requested


G

georg.heiss

Hi,
with:
$ netcat 192.168.1.254 23
i get this prompt:
??????!????Fritz!Box web password:
and after typing the password and
# ls
the telnet session works fine.

but with perl:
my $telnet = new Net::Telnet (Timeout => 55, Prompt => '/# /');
$telnet->open('192.168.1.254');
$telnet->login('root', 'passwd'); # user not needed only password is
requested
my @lines = $telnet->cmd("ls");

i get a timeout. Any Idea???
thanks
georg
 
Ad

Advertisements

D

DJ Stunks

Hi,
with:
$ netcat 192.168.1.254 23
i get this prompt:
??????!????Fritz!Box web password:
and after typing the password and
# ls
the telnet session works fine.

but with perl:
my $telnet = new Net::Telnet (Timeout => 55, Prompt => '/# /');
$telnet->open('192.168.1.254');
$telnet->login('root', 'passwd'); # user not needed only password is
requested
my @lines = $telnet->cmd("ls");

i get a timeout. Any Idea???

yes, I have some ideas. gather round kids while I read some
documentation!

It was a dark and stormy night and Net::Telnet said:

[The login()] method performs a standard login by waiting for a
login prompt and responding with *$username*, then waiting for
the password prompt and responding with *$password*, and then
waiting for the command interpreter prompt. If any of those
prompts sent by the remote side don't match what's expected,
this method will time-out, unless timeout is turned off.

Login prompt must match either of these case insensitive
patterns:

/login[: ]*$/i
/username[: ]*$/i

Password prompt must match this case insensitive pattern:

/password[: ]*$/i

Yes, Perl tries to DWIM, but come on...

I suggest you RTFM before asking the follow-up question "ok, so how
do I send my password to _my_ box?"

-jp
 
J

J. Gleixner

$ netcat 192.168.1.254 23
i get this prompt:
??????!????Fritz!Box web password:
and after typing the password and
# ls
the telnet session works fine.

but with perl:
my $telnet = new Net::Telnet (Timeout => 55, Prompt => '/# /');
$telnet->open('192.168.1.254');
$telnet->login('root', 'passwd'); # user not needed only password is
requested
my @lines = $telnet->cmd("ls");

i get a timeout. Any Idea???

Start with the documentation for Net::Telnet

perldoc Net::Telnet

From the documentation:

login - perform standard login
This method performs a standard login by waiting for a login prompt
[...]If any of those prompts sent by the remote
side don't match what's expected, this method will time-out, unless
timeout is turned off.
[...]
Use "dump_log()" to debug when this method keeps timing-out and you
don't think it should.

Maybe waitfor() will help.
 
G

georg.heiss

oh i am so ...first read the documentation is a really good idea,
thanks a lot for your fast help!!!
georg

J. Gleixner said:
$ netcat 192.168.1.254 23
i get this prompt:
??????!????Fritz!Box web password:
and after typing the password and
# ls
the telnet session works fine.

but with perl:
my $telnet = new Net::Telnet (Timeout => 55, Prompt => '/# /');
$telnet->open('192.168.1.254');
$telnet->login('root', 'passwd'); # user not needed only password is
requested
my @lines = $telnet->cmd("ls");

i get a timeout. Any Idea???

Start with the documentation for Net::Telnet

perldoc Net::Telnet

From the documentation:

login - perform standard login
This method performs a standard login by waiting for a login prompt
[...]If any of those prompts sent by the remote
side don't match what's expected, this method will time-out, unless
timeout is turned off.
[...]
Use "dump_log()" to debug when this method keeps timing-out and you
don't think it should.

Maybe waitfor() will help.
 
Ad

Advertisements

G

georg.heiss

oh i am so ...first read the documentation is a really good idea,
thanks a lot for your fast help!!!
georg

J. Gleixner said:
$ netcat 192.168.1.254 23
i get this prompt:
??????!????Fritz!Box web password:
and after typing the password and
# ls
the telnet session works fine.

but with perl:
my $telnet = new Net::Telnet (Timeout => 55, Prompt => '/# /');
$telnet->open('192.168.1.254');
$telnet->login('root', 'passwd'); # user not needed only password is
requested
my @lines = $telnet->cmd("ls");

i get a timeout. Any Idea???

Start with the documentation for Net::Telnet

perldoc Net::Telnet

From the documentation:

login - perform standard login
This method performs a standard login by waiting for a login prompt
[...]If any of those prompts sent by the remote
side don't match what's expected, this method will time-out, unless
timeout is turned off.
[...]
Use "dump_log()" to debug when this method keeps timing-out and you
don't think it should.

Maybe waitfor() will help.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top