2010-01-26 08:01:17 +00:00
|
|
|
#!/usr/bin/expect
|
|
|
|
|
|
|
|
set uname [lrange $argv 0 0]
|
|
|
|
set password [lrange $argv 1 1]
|
|
|
|
set host [lrange $argv 2 2]
|
2010-01-30 08:14:39 +00:00
|
|
|
set port [lrange $argv 3 3]
|
2010-01-26 08:01:17 +00:00
|
|
|
|
2010-01-30 08:14:39 +00:00
|
|
|
if { $port != "" } {
|
|
|
|
set port_option "-p $port"
|
|
|
|
} else {
|
|
|
|
set port_option ""
|
|
|
|
}
|
|
|
|
|
2010-02-08 03:56:56 +00:00
|
|
|
spawn ssh $port_option -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no $uname@$host
|
2010-01-26 08:01:17 +00:00
|
|
|
|
|
|
|
expect "*password: " {
|
|
|
|
send "$password\r"
|
|
|
|
} timeout {
|
|
|
|
send_user "Error connecting"
|
|
|
|
}
|
|
|
|
|
|
|
|
interact
|