   }
 
   expect timeout {
-    send_user " connection timeout\n"
-    break
+    send_user "connection timeout\n"
+    close
+    continue
   } eof {
-    send_user " done\n"
+    send_user "done\n"
   } "*-> " {
     send -s "exit\r"
     exp_continue

#!/usr/bin/expect

;# $Id:$

set send_slow {10 .01}
set timeout 60


  set error 0

  send_user "\[+\] $host - "


  spawn ssh -oControlMaster=auto -oLoglevel=ERROR $username@$host
 
  expect timeout {
    send_user "connection timeout\n"
    close
    continue 
  } eof {
    send_user "connection interrupted\n"
    continue
  } "Permission denied, please try again." {
    send_user " wrong credentials\n"
    continue 
  } "assword:" {
    send -s "$password\r"
    exp_continue
