title: Read Buffer data continuously running on remote windows command prompt
body: <p>I am connecting to remote windows host machine and executing cmd commands, which will start to print message on cmd screen. I need to pull the lines printed on cmd in real time using python.</p>
  
  <p>I am using paramiko to connect to remote windows host:</p>
  
  <pre><code>import paramiko
  client = paramiko.SSHClient()
  client.set_missing_host_key_policy(paramiko.AutoAddPolicy())
  client.connect(host=host, username=username, password=password)
  
  channel = client.invoke_shell()
  stdin = channel.makefile('wb')
  stdout = channel.makefile('rb')
  
  stdin.write('cmd_to_execute') # command which starts on cmd and start printing lines
  
  # read the buffer in real time
  
  print(stdout.read())
  
  client.close()
  </code></pre>
  
  <p>I am not able to get the proper parsed output. Could some tell me the right approach to solve the problem</p>
  
  <p>I get output like this when executed with 'whoami' command "b'\x1b[2J\x1b[2J\x1b[1;1H\x1b[0;39;24;27;37;40mMicrosoft Windows [Version 10.0.1482]                                          \n\x1b[2;1H(c) 2016 Microsoft Corporation. All rights reserved.                            \n\n\x1b[4;1Hadministrator@win C:\Users\Administrator>whoami                     \x1b[2J\x1b[4;54Hwhoami                     \x1b[4;55Hhoami                     \x1b[4;56Hoami                     \x1b[4;57Hami                     \x1b[4;58Hmi                     \x1b[4;59Hi                     \x1b[4;60H                     \x1b[5;1H'
  "</p>