Hi, perhaps you'll find my attached script useful. It connects to a locally running GTKG instance and logs into the remote shell automatically.
Any comments are welcome. Greetings, Thomas.
#!/usr/local/bin/expect # Copyright 2004 by Thomas Schuerger ([EMAIL PROTECTED]) # # Usage: gtkg-shell [port] # # This Expect script tries to connect to the remote shell # port of a locally running GTKG instance and tries to log in # using the ~/.gtk-gnutella/auth_cookie file. # # The default port number used is 6346. # # Expect can be found here: http://expect.nist.gov set fd [open "~/.gtk-gnutella/auth_cookie" "r"] gets $fd cookie close $fd set port "[lrange $argv 0 0]" if {$port == ""} { set port 6346 } spawn telnet 127.0.0.1 $port # set timeout to 3 seconds set timeout 3 expect { timeout,"Connection refused" {send_user "Unable to connect to GTKG on port $port.\n";exit} "Connected to " {} } # send authentication cookie send "HELO $cookie\n" expect { "100 " {} "400 " {exit} timeout {send_user "GTKG not available on port $port.\n";exit} } # connection was successful, switch to interactive mode interact
