For Programmers: Free Programming Magazines  


Home > Archive > Tcl > March 2006 > another expect question









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author another expect question
gbarn

2006-03-29, 10:01 pm

I've set "log_user 0" but still get the password on the screen when I do a
"send "$pass\r".

Anyone know how I can prevent this? I've tried "stty -echo" but that's for
keyboard echoing.

Regards



Uwe Klein

2006-03-30, 4:02 am

gbarn wrote:
> I've set "log_user 0" but still get the password on the screen when I do a
> "send "$pass\r".

got some debug statement in your script like
puts stderr $pass ?
>
> Anyone know how I can prevent this? I've tried "stty -echo" but that's for
> keyboard echoing.

could you post your script?

>
> Regards
>
>
>

uwe
gbarn

2006-03-31, 7:03 pm

The script is very simple.....

log_user 0
spawn ssh -l root system_name
send "password\r"
expect "*"
interact

I would like to stop the password from being printed to the screen.

Thank you



"Uwe Klein" <uwe_klein_habertwedt@t-online.de> wrote in message
news:e7isf3-fns.ln1@robert.houseofmax.de...
> gbarn wrote:
a[color=darkred]
> got some debug statement in your script like
> puts stderr $pass ?
for[color=darkred]
> could you post your script?
>
> uwe



Uwe Klein

2006-03-31, 7:03 pm

gbarn wrote:
> The script is very simple.....

.........tooo simple ;-)
>
> log_user 0
> spawn ssh -l root system_name

# ssh sends the password request , then
# flushes all input and switches to nonecho mode
# in preparation for the password input from the user
# place here:
expect "word: "
# youve seen the query now you may:
> send "password\r"



> expect "*"

# this call will expect exactly one "*"
# not all output upto now
# what you want is

expect -re ".*"

> interact
>
> I would like to stop the password from being printed to the screen.

what happens for you is :
you start ssh
you send a password

and no output is ever matched, all is still in the queue.

interact dumps all of that into your lap


uwe
gbarn

2006-03-31, 7:03 pm

The original script as presented worked fine.

However, I have made the suggested changes and the password is still printed
to my screen. The script is now:

log_user 0
spawn ssh -l root kull
expect "word:"
send "password\r"
expect -re ".*"
interact



"Uwe Klein" <uwe_klein_habertwedt@t-online.de> wrote in message
news:0e40g3-nse.ln1@robert.houseofmax.de...
> gbarn wrote:
> ........tooo simple ;-)
> # ssh sends the password request , then
> # flushes all input and switches to nonecho mode
> # in preparation for the password input from the user
> # place here:
> expect "word: "
> # youve seen the query now you may:
>
>
> # this call will expect exactly one "*"
> # not all output upto now
> # what you want is
>
> expect -re ".*"
>
> what happens for you is :
> you start ssh
> you send a password
>
> and no output is ever matched, all is still in the queue.
>
> interact dumps all of that into your lap
>
>
> uwe



Uwe Klein

2006-03-31, 7:03 pm

gbarn wrote:
> The original script as presented worked fine.
>
> However, I have made the suggested changes and the password is still printed
> to my screen. The script is now:
>
> log_user 0
> spawn ssh -l root kull
> expect "word: "

---------------^-mind the space
> send "password\r"
> expect -re ".*"
> interact


is the login successfull?

what happens with the password if you log in manually?

uwe

gbarn

2006-03-31, 7:03 pm

The login is successful with this script and with the original script.

When typing in the password manually, the login command on the remote
machine turns keyboard echo off. That way, no password is seen on the
screen.

With the script, however, I and "sending" the password the remote system so
it also appears on the screen. If someone is looking, they can see the
password. Does that help ??


"Uwe Klein" <uwe_klein_habertwedt@t-online.de> wrote in message
news:jnb0g3-lef.ln1@robert.houseofmax.de...
> gbarn wrote:
printed[color=darkred]
> ---------------^-mind the space
>
> is the login successfull?
>
> what happens with the password if you log in manually?
>
> uwe
>



Uwe Klein

2006-03-31, 7:03 pm

gbarn wrote:
> password. Does that help ??

Lets start back at the top:

what system/os are you working on

what system/os is "kull"

which version of expect and tcl are you using.
expect -v
from inside expect:
set tcl_patchLevel



uwe
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com