I have find answer with set failure ssh and create an other
spawn ssh -o StrictHostKeyChecking=no $username\@$host
expect {
timeout { send_user "\nTimeout Exceeded - Check Host\n"; set first_attempt_failed 1 }
eof { send_user "\nSSH Connection To $host Failed\n"; set first_attempt_failed 1 }
"*#" {}
"*assword:" {
send "$password\n"
}
}
if { [info exists first_attempt_failed] && $first_attempt_failed == 1 } {
spawn ssh -o KexAlgorithms=diffie-hellman-group1-sha1 -o StrictHostKeyChecking=no $username@$host
expect {
timeout { send_user "\nTimeout Exceeded - Check Host\n"; exit 1 }
eof { send_user "\nSSH Connection To $host Failed\n"; exit 1 }
"*#" {}
"*assword:" {
send "$password\n"
}
}
}
Thanks