Re: Net::Telnet prompt problem



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
.



Relevant Pages

  • Re: strange hang....try 2
    ... My Solution is to logon to the 'B' queues, ... My point is that one of the few times to log a session on the 'B' ... fresh session, got through login, no prompt. ... To join/leave the list, search archives, change list settings, * ...
    (comp.sys.hp.mpe)
  • Re: Re, Re : set prompt
    ... I want to be able to come back to a SmarTerm session and at least ... >>have a clue as to when things happened. ... >>you thought that I also wanted the default in the prompt and I don't! ...
    (comp.os.vms)
  • Re: problems with normal.dot
    ... Save Normal template," and when I close Word the program asks me if I want ... Under Tools, Options, have you checked the box 'Prompt to Save Changes to ... current session, but if I close down Word for any reason and then ... If I exit Word and restart it again, ...
    (microsoft.public.word.application.errors)
  • Re: problems with normal.dot
    ... but I don't have the option for "prompt to save changes to Normal." ... Things work okay in a current session, but if I close down Word for any reason and then restart it, my normal.dot file is back to the way it was at the time I installed the program. ...
    (microsoft.public.word.application.errors)
  • Re: Re, Re : set prompt
    ... I want to be able to come back to a SmarTerm session and at least ... > I don't have anything to run DECwindows on and I don't have any real ... > you thought that I also wanted the default in the prompt and I don't! ... > have already added appropriate commands to my login.com for that. ...
    (comp.os.vms)