Net::Telnet prompt problem

C

colintelfer

I get this error when running my small test program...

timed-out waiting for login prompt

....
$host = '192.168.100.251';
$port = '24';
$username = 'admin';
$password = '';
$prompt = '/User:/';
$session = new Net::Telnet
(
Timeout => 5,
Prompt => $prompt
);

$session->input_log("inputlog.txt");
$session -> open(Host => $host,Port => $port);
$session -> login($username, $password);
....

Here is the ouput from inputlog.txt:

(Sys)
User:

I am guessing there is a problem with prompt, but I have tried a few
different matches without success...

Any help?

Thanks!
 
M

Maxim

I get this error when running my small test program...

timed-out waiting for login prompt

...
$host = '192.168.100.251';
$port = '24';
$username = 'admin';
$password = '';
$prompt = '/User:/';
$session = new Net::Telnet
(
Timeout => 5,
Prompt => $prompt
);

$session->input_log("inputlog.txt");
$session -> open(Host => $host,Port => $port);
$session -> login($username, $password);
...

Here is the ouput from inputlog.txt:

(Sys)
User:

I am guessing there is a problem with prompt, but I have tried a few
different matches without success...

Any help?

Thanks!

Prompt has no effect on login function. Well, it does, but not on
username/password command-line patterns.
login function waits for patterns like this:

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

You have the prompt "User:", that is why login times out; Try using
print/waitfor instead. It can be something like this:
$session->waitfor('/User:/')
$session->print($username);
$session->waitfor('/password:');
$session->print($password);
$session->waitfor($cmd_line_prompt);

....
and so on.

Hope this Helps a little.
 

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

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,537
Members
45,023
Latest member
websitedesig25

Latest Threads

Top