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 ログイン セッションが機能するように、ユーザーとパスワードの文字列をフォーマットする方法を知っている人がいるでしょうか?