From: Wim V. <wve...@re...> - 2002-06-19 00:24:22
|
I am trying to use the expect module to interact with a windows 2000 = system via telnet. The login is detected but when I need to enter the username it does not = seem to continue (it seems as if the enter is not transmitted or = understood). Does anyone ever used it to connect to a windows system? What am I = missing here? Here is what I see: forgive my personal debugging. ...........Looking for 'login or login' in TIME: '30' seconds Trying xxx.xxx.xxx.xxx... Connected to xxx.xxx.xxx.xxx. Escape character is '^]'. Microsoft (R) Windows (TM) Version 5.00 (Build 2195) Welcome to Microsoft Telnet Service Telnet Server Build 5.00.99201.1 login: exp..............Found(login). ..............printing with argument administrator exp...........Looking for 'password or password' in TIME: '30' seconds administrator exp.............Did not find "password or password"... Thanks Wim |
From: Simon T. <si...@un...> - 2002-06-19 00:35:26
|
On Wed, 19 Jun 2002 10:26, Wim Verhaert wrote: > I am trying to use the expect module to interact with a windows 2000 system > via telnet. > > The login is detected but when I need to enter the username it does not > seem to continue (it seems as if the enter is not transmitted or > understood). Does anyone ever used it to connect to a windows system? What > am I missing here? This should be straightforward enough, why don't you post the code fragment, and I'll see if I can run it here. Regards, Simon Taylor -- Unisolve Pty Ltd - Melbourne, Australia +61 3 9568 2005 |
From: <ex...@ih...> - 2002-06-19 01:00:50
|
Are you sure you're expecting the right string? why does it print "looking for password or password"? On Tue, 18 Jun 2002 17:26:27 -0700 "Wim Verhaert" <wve...@re...> wrote: > I am trying to use the expect module to interact with a windows 2000 system via telnet. > > The login is detected but when I need to enter the username it does not seem to continue (it seems as if the enter is not transmitted or understood). > Does anyone ever used it to connect to a windows system? What am I missing here? > > > Here is what I see: forgive my personal debugging. > > ...........Looking for 'login or login' in TIME: '30' seconds > Trying xxx.xxx.xxx.xxx... > Connected to xxx.xxx.xxx.xxx. > Escape character is '^]'. > Microsoft (R) Windows (TM) Version 5.00 (Build 2195) > Welcome to Microsoft Telnet Service > Telnet Server Build 5.00.99201.1 > login: > exp..............Found(login). > ..............printing with argument administrator > > exp...........Looking for 'password or password' in TIME: '30' seconds > administrator > > exp.............Did not find "password or password"... > > > Thanks > > Wim > > |
From: Austin S. <te...@of...> - 2002-06-19 05:09:44
|
On Tue, Jun 18, 2002 at 05:26:27PM -0700, Wim Verhaert wrote: > I am trying to use the expect module to interact with a windows 2000 system via telnet. > > The login is detected but when I need to enter the username it does not seem to continue (it seems as if the enter is not transmitted or understood). > Does anyone ever used it to connect to a windows system? What am I missing here? > > > Here is what I see: forgive my personal debugging. When in doubt use the debugging included with the module. $Expect::Debug=1; $Expect::Exp_Internal=1; $telnet= Expect->spawn('telnet'); etc. Austin |
From: Roland G. <RGi...@CP...> - 2002-06-19 06:48:25
|
> Wim Verhaert wrote: > > I am trying to use the expect module to interact with a windows 2000 system via telnet. Have you taken a look at the Net::Telnet module? Any specific reasons to not use it? Oh, BTW, you should be able to use Net::Telnet together with Expect by initializing the Expect object with the Net::telnet filehandle (but I haven't tried this, so feedback is appreciated...). Hope this helps, Roland |
From: Wim V. <wve...@re...> - 2002-06-19 21:32:50
|
Thanks for the replies,... It seems that the problem I have is related to the folowing command print $session "$argument\n"; The problem now in the windows environement is the '\n'. When I replace this with '\r' it works. I never had this problem in a unix environement. Any comments? Thanks Wim ----- Original Message ----- From: "Roland Giersig" <RGi...@CP...> To: "Wim Verhaert" <wve...@re...> Cc: <exp...@li...> Sent: Tuesday, June 18, 2002 11:48 PM Subject: Re: [Expectperl-discuss] Windows interaction > > Wim Verhaert wrote: > > > > I am trying to use the expect module to interact with a windows 2000 system via telnet. > > Have you taken a look at the Net::Telnet module? Any specific reasons to not use it? > Oh, BTW, you should be able to use Net::Telnet together with Expect by initializing the > Expect object with the Net::telnet filehandle (but I haven't tried this, so feedback is > appreciated...). > > Hope this helps, > > Roland > |
From: Austin S. <te...@of...> - 2002-06-20 00:28:11
|
On Wed, Jun 19, 2002 at 02:34:49PM -0700, Wim Verhaert wrote: > Thanks for the replies,... > It seems that the problem I have is related to the folowing command > > print $session "$argument\n"; > > The problem now in the windows environement is the '\n'. When I replace this > with '\r' it works. > I never had this problem in a unix environement. Any comments? > This is an excellent question. I have had trouble with different unix applications expecting \r, so it's not windows specific. I suspect preference for \r vs \n is application specific, though there are terminal parameters to specify whether \n gets translated to \r or vice-versa. Then, a beauty of arcane history, when it gets echoed back to you it is again filtered by the tty output settings (which is also configurable via stty or IO::Stty, etc). I don't have any good answer for why an application would prefer one vs. the other. Probably also arcane historical reasons. Most apps seem to like \n. IIRC when I used cu to talk to modems they liked \r. Short answer: do whatever works. Austin |
From: Roland G. <RGi...@cp...> - 2002-06-20 08:46:58
|
> On Wed, Jun 19, 2002 at 02:34:49PM -0700, Wim Verhaert wrote: > > Thanks for the replies,... > > It seems that the problem I have is related to the folowing command > > > > print $session "$argument\n"; > > > > The problem now in the windows environement is the '\n'. When I replace this > > with '\r' it works. > > I never had this problem in a unix environement. Any comments? > > > > This is an excellent question. I have had trouble with different > unix applications expecting \r, so it's not windows specific. Actually, "\r" is the correct thing to do to emulate the user pressing the <return> key. This will usually get translated to "\n" in the pty according to terminal settings, but this is of course system-specific. Please note the different semantics: you are emulating a user at a keyboard, you are not driving the application via a pipe. > Short answer: do whatever works. Right. :-) Hope this helps, Roland -- RGi...@cp... |
From: Austin S. <te...@of...> - 2002-06-20 17:38:08
|
On Thu, Jun 20, 2002 at 10:46:54AM +0200, Roland Giersig wrote: > > On Wed, Jun 19, 2002 at 02:34:49PM -0700, Wim Verhaert wrote: > > > Thanks for the replies,... > > > It seems that the problem I have is related to the folowing command > > > > > > print $session "$argument\n"; > > > > > > The problem now in the windows environement is the '\n'. When I > replace this > > > with '\r' it works. > > > I never had this problem in a unix environement. Any comments? > > > > > > > This is an excellent question. I have had trouble with > different > > unix applications expecting \r, so it's not windows specific. > > Actually, "\r" is the correct thing to do to emulate the user pressing > the <return> key. Ahh, this makes sense. Another good FAQ candidate IMO. Austin |