63 lines
1.4 KiB
Plaintext
63 lines
1.4 KiB
Plaintext
# Handle the interaction
|
|
expect {
|
|
"Password:" {
|
|
send "$password\r"
|
|
exp_continue
|
|
}
|
|
"Enter password:" {
|
|
send "$password\r"
|
|
exp_continue
|
|
}
|
|
"Please enter your password:" {
|
|
send "$password\r"
|
|
exp_continue
|
|
}
|
|
"Authentication successful" {
|
|
puts "Authentication completed successfully!"
|
|
# Process completed successfully, wait for it to finish
|
|
catch {expect eof}
|
|
catch {wait}
|
|
exit 0
|
|
}
|
|
"Login successful" {
|
|
puts "Login completed successfully!"
|
|
catch {expect eof}
|
|
catch {wait}
|
|
exit 0
|
|
}
|
|
"Authentication completed" {
|
|
puts "Authentication completed!"
|
|
catch {expect eof}
|
|
catch {wait}
|
|
exit 0
|
|
}
|
|
"Invalid credentials" {
|
|
puts stderr "Authentication failed: Invalid credentials"
|
|
catch {expect eof}
|
|
catch {wait}
|
|
exit 1
|
|
}
|
|
"Login failed" {
|
|
puts stderr "Authentication failed: Login failed"
|
|
catch {expect eof}
|
|
catch {wait}
|
|
exit 1
|
|
}
|
|
"Authentication failed" {
|
|
puts stderr "Authentication failed"
|
|
catch {expect eof}
|
|
catch {wait}
|
|
exit 1
|
|
}
|
|
eof {
|
|
puts "Process ended unexpectedly"
|
|
catch {wait}
|
|
exit 1
|
|
}
|
|
timeout {
|
|
puts stderr "Authentication process timeout"
|
|
catch {expect eof}
|
|
catch {wait}
|
|
exit 1
|
|
}
|
|
} |