Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- set prompt {\$ $}
- set file1 [open [lindex $argv 0] r]
- set pw1 [exec cat /home/msnyder/bin/.pw1.txt]
- set pw2 [exec cat /home/msnyder/bin/.pw2.txt]
- while {[gets $file1 host] != -1} {
- puts $host
- spawn -noecho ssh $host
- expect {
- "continue connecting" {
- send "yes\r"
- expect {
- "current" {
- send -- $pw2\r
- exp_continue
- }
- "New password" {
- send -- $pw1\r
- exp_continue
- }
- "Retype new password" {
- send -- $pw1\r
- exp_continue
- -re $prompt # I'm not sure about this one. Does it belong here? This is where you put it.
- }
- }
- -re $prompt
- }
- send -- exit\r
- expect eof
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement