title: Reading PuTTY output with c#
body: <p><strong>What i want:</strong> I want to read the Output of the PuttY Window with C#</p>
  
  <p><strong>What I've got:</strong> Our company has several hundreds of servers with at least 2-3 technical users (which are running applications). We got a database of all the users and passwords. So it's basically search, copy and paste to login.</p>
  
  <p><strong>What i want to do:</strong> Write a piece of software that does this automatically.</p>
  
  <p><strong>How far i am:</strong> Wrote a tool, that reads the logfile of a single PuTTY instance and looks for the password prompt. Determinates target user and server (based on current server and su - [username]). Retrieves the password and sends it via PostMessage to a selected PuTTY.</p>
  
  <p><strong>The Problem or what i want to change:</strong></p>
  
  <p>I want to be able to read the PuTTY output directly from the PuTTY window, because the logfile is kind of unreliable (TAB, ESCAPE, etc which scrambles the output).
  I have used UISpy and other tools to get a control, but no luck.</p>
  
  <p>I don't want to use a keylogger mechanism or something like that.</p>
  
  <p>Maybe a hook or something, but have never done that before.</p>
  
  <p><strong>Additonal Info:</strong></p>
  
  <ul>
  <li>Connection is made over a JumpServer, only ssh connections from there to the target servers are allowed.</li>
  <li>Direct login with the tech. user is disabled.</li>
  <li>The PuTTY window is already opened and used to work on the server.</li>
  <li>Writing a whole new Connection Manager is no option. Coworkers are familar with PuTTY and this solution should be some sort of standalone background worker.</li>
  </ul>
  
  <p><strong>Additonal Info 2:</strong>
  The goal is to write a strict 3rd party software. Not to use other SSH libs, modify PuTTY source or other approaches. The question is: how to read text from the PuTTY window, beside the logfiles.</p>