Re: Net::Telnet prompt problem
- From: Maxim <m.sloyko@xxxxxxxxxx>
- Date: Thu, 14 Apr 2005 09:36:20 +0400
colintelfer@xxxxxxxxxxx wrote:
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.
-- Maxim Sloyko .
- Follow-Ups:
- Re: Net::Telnet prompt problem
- From: colintelfer
- Re: Net::Telnet prompt problem
- References:
- Net::Telnet prompt problem
- From: colintelfer
- Net::Telnet prompt problem
- Prev by Date: Re: help understanding ++
- Next by Date: Q: Extract AVI/MOV video frames to JPEG files ?
- Previous by thread: Net::Telnet prompt problem
- Next by thread: Re: Net::Telnet prompt problem
- Index(es):
Relevant Pages
|