2014-09-18 01:12:55 +05:30
|
|
|
#!/usr/bin/expect
|
|
|
|
|
|
|
|
if {$argc == 1} {
|
|
|
|
set user [lindex $argv 0]
|
|
|
|
} else {
|
|
|
|
set user "foo"
|
|
|
|
}
|
|
|
|
|
|
|
|
set timeout 2
|
2023-02-08 08:42:59 +05:30
|
|
|
expect_after default {puts stderr "\nFAIL"; exit 1}
|
2014-09-18 01:12:55 +05:30
|
|
|
|
|
|
|
set timeout 5
|
2023-02-08 08:42:59 +05:30
|
|
|
expect_after default {puts stderr "\nFAIL"; exit 1}
|
2014-09-18 01:12:55 +05:30
|
|
|
|
|
|
|
spawn /bin/bash
|
|
|
|
expect "# "
|
|
|
|
|
|
|
|
send "login $user\r"
|
|
|
|
expect "Password: "
|
|
|
|
sleep 0.1
|
|
|
|
send "badpass\r"
|
|
|
|
send_user "\n# password 'badpass' sent\n\n"
|
|
|
|
expect "login: "
|
|
|
|
|
|
|
|
send "exit\r"
|
|
|
|
exit 0
|