Open basu45 opened 3 months ago
@sriramkannan95 can u help on this issue
Details please? Show the part of code that is giving the issue. What exactly are you trying to do and what did you get?
@sriramkannan95 The code is ''' Import paramiko From paramiko-expect import SSHClientInteraction Client=paramiko.SSHClinet() Client.set_missing_host_key_policy(paramiko.AutoAddPolicy()) Client.connect(hostname,user,password) Interact=SSHClientInteraction(Client,timeout=60,) Interact.expect(r'.[\$#>]\s+) Interact.send('who am i') Interact.expect(r'.[\$#>]\s+) ''' Ssh is done to 2019 windows vm Getting similar output as of https://stackoverflow.com/questions/61381631/read-buffer-data-continuously-running-on-remote-windows-command-prompt?noredirect=1&IQ=1
And also same output is repeated more than once
Doesnot look like exepect issue Looks like issue with how paramiko interacts with 2019 ssh
The issue seems like Unicode escape sequences.
The code should be taking them out, if it works as expected
The issue seems like Unicode escape sequences.
The code should be taking them out, if it works as expected
Also see https://superuser.com/a/1785495/1256163
The best thing would be to make sure pty is for sure turned off, and the rest of the suggestion made there
The issue seems like Unicode escape sequences. The code should be taking them out, if it works as expected
Also see https://superuser.com/a/1785495/1256163
The best thing would be to make sure pty is for sure turned off, and the rest of the suggestion made there
But how to turn off the pty. The SSHClientInteraction class init method itself calls invoke_shell() which inherently requests a pty
NOTE: THE ISSUE IS ONLY WITH 2019 WINDOWS VERSION
Update:tested with bitvise ssh server in place of openssh server it appears to be working fine with it. But we cannot use bitvise ssh server as it's paid version for organization level.
Hi any suggestions??
Hello, Any updates??
@fruch, @sriramkannan95,
I believe the ask here is for paramiko_expect
to provide a mechanism to turn off the pty. Currently I see that it is internally calling client.invoke_shell()
in the SSHClientInteraction
constructor,
self.channel = client.invoke_shell(term=term, width=tty_width, height=tty_height)
I believe the client.invoke_shell()
internally calls get_pty()
. Is it possible to do something discussed on the below lines (have a flag in the constructor to get the channel.invoke_shell()
called without calling get_pty()
)?
https://stackoverflow.com/questions/58063024/can-i-call-channel-invoke-shell-without-calling-channel-get-pty-beforehand
This can be considered as an enhancement and not a bug as we want to support SSH server on the new OS type/version.
When expect function is used to extract data from windows 2019 machine we are getting a lot of garbage in output .