1

I'm writing a simple executable in C that needs to open a putty session and send commands to it, then close putty. I can open/close the putty session (i'm not that bad) but i'm not too sure on how to send putty the commands.

Any ideas??

3 Answers3

3

From the PuTTY FAQ:

How can I use PuTTY to make an SSH connection from within another program?

Probably your best bet is to use Plink, the command-line connection tool. If you can start Plink as a second Windows process, and arrange for your primary process to be able to send data to the Plink process, and receive data from it, through pipes, then you should be able to make SSH connections from your program.

This is what CVS for Windows does, for example.

Plink can use PuTTY's saved sessions in addition to opening sites directly.

PLink's options are documented in Chapter 7 of the PuTTY manual.

Powerlord
  • 87,612
  • 17
  • 125
  • 175
2

Use the DLL, Luke. http://www.winputty.com/

vartec
  • 131,205
  • 36
  • 218
  • 244
0

Have you looked at the source for QuickPutty? It's LGPL licensed.

Alnitak
  • 334,560
  • 70
  • 407
  • 495
  • But what IS it? The link provides no information about what it does. Just a half-dozen download links. – Rob Kennedy Mar 02 '09 at 19:49
  • it's a quick-start front-end to PuTTY, which provides a desktop window with links to each defined PuTTY profile. If the OP actually wants to send I/O to an SSH shell started via PuTTY it's probably not that useful. – Alnitak Mar 02 '09 at 19:59