我想使用Expect脚本自动执行登录过程。 我们的想法是Expect脚本将启动telnet并登录。 我需要这个脚本用于我正在开发的C#客户端应用程序。
这将是剧本:
#!/usr/bin/expect
set timeout 20
set ip [lindex $argv 0]
set port [lindex $argv 1]
set user [lindex $argv 2]
set password [lindex $argv 3]
spawn telnet $ip $port
expect "'^]'."
sleep .1;
send "\r";
expect { "login:" {
send "$user"
expect "Password:"
send "$password";
interact
send "\r";
expect { "login:" {
send "$user"
expect "Password:"
send "$password";
interact
}
"host: Connection refused"{
send_user "ERROR:EXITING!"
exit
}
}
问题是我收到此错误: Botty(Eggdrop v1.8.0 + preinit(C)1997 Robey Pointer(C)2010 Eggheads)
Please enter your nickname.
Sorry, that nickname format is invalid.
Connection closed by foreign host.
有人可能知道如何格式化用户名和密码字符串,以便通过telnet登录eggdrop会有效吗?