#!/usr/bin/expect -f
set passwdlist { public {1 2 2x} wls81 {1 2 zx} }
foreach {u p} $passwdlist {
spawn ssh $u@localhost
lassign $p s(1) s(2) s(3)
set i 1
puts $s(1),$s(2),$s(3)
expect {
*yes/no* {send "yes\r";exp_continue}
*assword:* {puts $u,$s($i);send "$s($i)\r";incr i ; exp_continue}
*public* {send "echo Gooooood\r";interact}
}
}
阅读(2616) | 评论(0) | 转发(0) |