Results 1 to 1 of 1
Hi folks..
I am on Windows XP, but this question relates to some software mainly used on Linux, so i'm hoping someone might be able to help me.
Here is ...
- 07-01-2007 #1Just Joined!
- Join Date
- Jul 2007
- Posts
- 1
Sending commands to telnet
Hi folks..
I am on Windows XP, but this question relates to some software mainly used on Linux, so i'm hoping someone might be able to help me.
Here is basically what I am wanting to do. I'm trying to make a simple 'Disconnect' icon on my desktop for my router. Basically, if the user clicks on it, it should telnet to the router, send the commands to disconnect, and exit. This has turned out to be an enormous feat however.
I'm trying to use the Expect package to do this as it appears to be the easiest way. Unfortunately, since it's Windows, there is no autoexpect command with the Expect package, and this makes it even more troublesome.
I've named the file with my router commands test.tcl, and pasted the following commands into it. The parentheses I added in for comments:
package require Expect
spawn telnet 192.168.0.1 23
exp_send "mypassword\n" (this logs in with a password)
exp_send "24\n" (this navigates a menu)
exp_send "1\n" (this navigates a menu)
exp_send "4\n" (this disconnects the router)
exp_send "\17" (this is *supposed* to be a way to send the escape key, but it's not working)
exp_send "\17" (this is *supposed* to be a way to send the escape key, but it's not working)
exp_send "99\n" (this closes the telnet session)
I then create my icon, a batch file which runs: tclsh test.tcl
But clicking it does not do what is intended, and I can't figure out why.
If anyone has any ideas, I would be extremely grateful! I'm really stumped here, and it's getting very frustrating after spending 10+ hours on such a simple problem as this.


Reply With Quote