[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: NOC scripting



On Tuesday 23 January 2001, at 16 h 50, the keyboard of Debian Ghost 
<debian-isp@ghost.ntelos.net> wrote:

> switches and devices) so I gess basically what I need is a scripting
> method to read in login: and reply passwd: and reply 

expect, without any doubt. Example at the end.

> and a method to place
> and size Eterm/Xterm on various virtual desktops (E) ?

Depends on your window manager. 

To connect on a machine whose syadmin does not want to install ssh :-(

#!/usr/bin/expect -f

set host dahlia.xxx.yyy.fr
set login bortzmeyer
set password jevaispasledire

spawn telnet $host

expect  {*login:*} {} \
        timeout {timedout "waiting for password prompt"}
send ${login}\r

expect  {*Password:*} {} \
        timeout {timedout "waiting for password prompt"}
send ${password}\r
expect {*invalid login*}    {send_user "Bad password\n"; exit} \
        {*Last unsuccessful}            {} \
        timeout         {timedout waiting for login prompt}

send \r

interact

proc timedout {} {
        send_user "Server timed out.  Try again later.\n"
        exit 1
}




Reply to: