PowerShell / PowerShell/Win32-OpenSSH

Paramiko ssh connection giving lots of residue output

Open
#2,242 6 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Area-sshd Area-Terminal Investigate
Dominant language
No language data
Stars
8.3k
Forks
819
PR merge metrics
No merged PRs in 30d

Description

Prerequisites
  • Write a descriptive title.
  • Make sure you are able to repro it on the latest version
  • Search the existing issues.
Steps to reproduce
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()
While channel.send_ready():
    channel.send('who am i\n')
While channel.rec_ready():
    Output=channel.recv(1024).decode()
Print(Output)

The issue is when we are using paramiko to connect to windows 2019 vm with invoke_shell() we are getting a lot of residue/garbage output.
The output is similar to
(https://stackoverflow.com/questions/61381631/read-buffer-data-continuously-running-on-remote-windows-command-prompt?noredirect=1&IQ=1)

And also the output is repeated multiple times.

Checked with bitvise ssh server it works fine with bitvise server

Tried with different version of openssh but same issue.

Any suggestions to get the clean output and non repeated/duplicate output

Expected behavior
Clean output
Actual behavior
"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' "
Error details

No response

Environment data
PSversion.                                     5.1.17763.5933
PsEdition.                                       Desktop
PSCompatibleVersions.                {1.0,2.0,30.,4.0.....}
BuildVersion.                                  10.0.17763.5993
CLRVersion.                                     4.0.30319.42000
WSManStackVersion.                      3.0
PSRemotingProtocolVersion.          2.3
Serialisation version.                          1.1.0.1
Version

OpenSSH_for_Windows_9.5p1, LibreSSL 3.8.2

Visuals

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the behavior through Paramiko's SSHClient, invoke_shell(), channel.send_ready(), and channel.recv_ready() against OpenSSH_for_Windows 9.5p1 on Windows Server 2019. Compare the received escape sequences and repeated characters with the expected clean output; done means identifying the source of the residue and duplication and documenting or correcting the behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
networking, operating-systems
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.