KpyM Telnet/SSH Server - Forum
Scripting with PuTTY, anyone?
Tors10 Scripting with PuTTY, anyone?
 
Has anyone had any luck scripting this with plink?

The CONSC utility doesn't seem to work with plink or putty. It hangs on the connection.

I'm using Kpym on the server, and PuTTY/plink on the client.

Anyone have luck with this?

(I don't know if it is related, when I use plink to connect to the server, it gives me an arrow pointing to whatever i had input, with a [x,y where x,y are random #'s)


Kroum Grigorov
 
You can find bellow two sample CONSC scripts that work fine with KTS.
The first one uses plink.exe(you need the latest plink version 0.58), plink does'not interpret telnet ESC sequences that's why you see the garbage #[x,y characters
Code:

;
; clear screen
;
SEND cls\n
;
; start plink.exe
;
SEND c:\progra~1\putty\plink.exe user@12.34.56.789\n
;
; wait for nag screen then press enter to dissmiss it
;
WAIT Press any key to continue...
SEND \n
;
; type the pass
;
SEND my-secret-password\n
;
; execute the remote command(s)
;
SEND dir\n
;
; wait for command(s) to complete
;
WAIT bytes free
;
; exit plink session
;
SEND exit\n
;
; press enter to force plink to quit
;
SEND \n
;
; wait for command prompt
;
WAIT G:\consc\Release>
;
; close spawned prompt
;
SEND exit\n
SLEEP 2

The second one uses ssh.exe (that's OpenSSH client) if you need readable output you better use this one.

Code:

;
; clear screen
;
SEND cls\n
;
; start ssh.exe
;
SEND C:\PROGRA~1\OpenSSH\bin\ssh.exe user@12.34.56.789\n
;
; wait for nag screen then press enter to dissmiss it
;
WAIT Press any key to continue...
SEND \n
;
; type the pass
;
SEND my-secret-password\n
;
; execute the remote command(s)
;
SEND dir\n
;
; wait for command(s) to complete
;
WAIT bytes free
;
; exit ssh session
;
SEND exit\n
;
; press enter to force ssh to quit
;
SEND \n
;
; wait for command prompt
;
WAIT G:\consc\Release>
;
; close spawned prompt
;
SEND exit\n
SLEEP 2


Note that these two scripts are samples only you will need to change them to run correctly in your environment


Tors10 My mistake
 
I forgot the \n, so it was not running the command. I was waiting for the wait command to finish...

You rock, dude!


 

© 2007 - 2008 Kroum Grigorov
Powered by phpBB © 2001, 2005 phpBB Group