Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
#!/usr/bin/tclsh
package require Expect
####functions#########
proc getIn {msg} {
stty -echo
puts -nonewline "INPUT:$msg "
flush stdout
set ans [gets stdin]
stty echo
return ans
}
#exp_internal 1
set timeout 125
#first and second args are remote hostname and username.
set username [lindex $argv 0]
set prompt ".*@.*"
set rootprompt "root@.*"
####main()###########
foreach poss [lrange $argv 1 [llength $argv]] {
spawn -noecho deslogin $username@$poss
lappend ids $spawn_id
expect {
-re ".*ass.*hras.*" {
send "[getIn \"Enter password for $poss\"]\r"
expect -re $prompt {
send "TERM=vt100\r"
send "su root\r"
expect -re ".*assw.*" {
send "[getIn \"Root password please\"]\r"
expect -re "$rootprompt" {
send "passwd\r"
expect -re ".*ew.*assw.*" {
set new [getIn "\New password\"]
send "$new\r"
expect -re ".*enter.*assw.*" {
send "$new\r"
expect -re "$rootprompt" {interact -i $spawn_id}
}
}
}
}
}
}
}
}
#remainder of script allows the user to interact with the spawnede sessions, switch back and forth, issues a keepalive, etc..