1

我想使用 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 登录会话?

4

0 回答 0