From: Uwe Klein on 11 Feb 2010 10:30 fedorafans wrote: > Thanks for your reply, I ran the script on another machine with same > result. > > I know this is caused by the target system, and I was hoping there > were some workarounds. :( Does your target send "password:" or "password: " ( notice the trailing space ) do your [expect]'s run into any timeouts? ( forex in [ expect "admin"] ? ( add the timeout case to all expect calls! ) sendings passwords when the recipient is not ready is the mistake of choice for expect users ;-) uwe
From: fedorafans on 11 Feb 2010 12:08 Could you elaborate a little bit on this? It seems that that system sends out "password: ", i am not really an expect guy(only one weeks of experience),but i think to expect, it does not matter, expect just want a match for "password:", am I correct? And I think adding timeout won't resolve the problem. Thanks > Does your target send "password:" or "password: " ( notice the trailing space ) > > do your [expect]'s run into any timeouts? ( forex in [ expect "admin"] ? > ( add the timeout case to all expect calls! ) > > sendings passwords when the recipient is not ready > is the mistake of choice for expect users ;-) > > uwe
From: Uwe Klein on 11 Feb 2010 12:59 fedorafans wrote: > Could you elaborate a little bit on this? > > It seems that that system sends out "password: ", i am not really an > expect guy(only one weeks of experience),but i think to expect, it > does not matter, expect just want a match for "password:", am I > correct? most login procedures send "password: ", flush output, drain and discard input, change input to no_echo, wait for input. if you send the password after receiving the ":" there is a good chance that a part or all of your input is lost in the input drain/discard. putting a delay in front of the send $password may seem to work on occasion but usually makes the script fragile and/or slow. expect the complete output from the client side! http://wiki.tcl.tk/18013 > > And I think adding timeout won't resolve the problem. Adding timeouts i.e. delays does not. The request was to handle timeouts in expect i.e. expect \ $phrase1 { puts "phrase1 seen" } $phrase2 { puts "phrase2 seen" } eof { # connection down puts stderr "expect: eof" exit 1 } timeout { # this is an error! puts stderr "expect: TIMEOUT!" exit 2 } "eof" and "timeout" are special words like "default" in [switch] default timeout is 10s, change it with set timeout $newtimeout uwe
From: fedorafans on 11 Feb 2010 13:38 Really appreciated your help here. I am still reading the link you referred to. While I did a quick test and changed my script matching "password: ", also I added "sleep 3", still same result. On Feb 11, 11:59 am, Uwe Klein <uwe_klein_habertw...(a)t-online.de> wrote: > fedorafans wrote: > > Could you elaborate a little bit on this? > > > It seems that that system sends out "password: ", i am not really an > > expect guy(only one weeks of experience),but i think to expect, it > > does not matter, expect just want a match for "password:", am I > > correct? > > most login procedures > send "password: ", > flush output, > drain and discard input, > change input to no_echo, > wait for input. > > if you send the password after receiving the ":" there is a good > chance that a part or all of your input is lost in the input drain/discard. > > putting a delay in front of the send $password may seem to work on occasion > but usually makes the script fragile and/or slow. > > expect the complete output from the client side! > http://wiki.tcl.tk/18013 > > > And I think adding timeout won't resolve the problem. > > Adding timeouts i.e. delays does not. > > The request was to handle timeouts in expect i.e. > expect \ > $phrase1 { > puts "phrase1 seen" > } $phrase2 { > puts "phrase2 seen" > } eof { > # connection down > puts stderr "expect: eof" > exit 1 > } timeout { > # this is an error! > puts stderr "expect: TIMEOUT!" > exit 2 > } > > "eof" and "timeout" are special words like "default" in [switch] > default timeout is 10s, change it with > set timeout $newtimeout > > uwe
First
|
Prev
|
Pages: 1 2 Prev: question on kbskit/starkit Next: Block all keyboard input for a toplevel. |