I am trying to harden my expect script, and so far I have the "usual prompts covered" (I can not really say they are prompt persay) but what happens if for some reason the host that the expect script is logging into changes its screens? How can I account for that?
Is there a way that if it does not receive any of the prompts listed below, it puts $FILE error, then continues on with the script?
expect {
"200? \\*\\*\\*\r\n>$"
{ change_pass }
"200? \\*\\*\\**\r\n>$"
{ change_pass }
"Invalid user name or password.\r\nEnter User Name\r\n>$" {
puts $PASS_ERROR "$LINE, Invalid user name or passwd, passwd was not changed."; continue
}
"User logged in on another device, please try again." {
puts $PASS_ERROR "$LINE, had user logged in, passwd was not changed."; continue
}
}
Is there a way that if it does not receive any of the prompts listed below, it puts $FILE error, then continues on with the script?
expect {
"200? \\*\\*\\*\r\n>$"
{ change_pass }
"200? \\*\\*\\**\r\n>$"
{ change_pass }
"Invalid user name or password.\r\nEnter User Name\r\n>$" {
puts $PASS_ERROR "$LINE, Invalid user name or passwd, passwd was not changed."; continue
}
"User logged in on another device, please try again." {
puts $PASS_ERROR "$LINE, had user logged in, passwd was not changed."; continue
}
}