1

I want to automate a login proces using a Expect script. The idea is that the Expect script will start telnet and login. I need this script for my C# client application that im developing.

This will be the script:

#!/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
  }
}

The problem is that i am getting this error: 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.

Someone maybe has an idea how to format the user- and password-string so that a eggdrop login sesion via telnet will work?

Marice
  • 37
  • 5
  • Looks like problem with the eggdrop bot. Are you getting this prompt for nickname when do it manually ? If yes, then you have to add it up with `expect` script too. – Dinesh Oct 19 '14 at 02:36
  • 1
    You should add `\r` when sending stuff. – Johannes Kuhn May 09 '15 at 23:03
  • @Johannes Kuhn Wow thanks, I will try this as soon as i start working on the project again (its been a few months you see). – Marice May 09 '15 at 23:15

0 Answers0