By default you can't write to the Standard Input of a running SshCommand and can only write to a process running in SSH by using CreateShellSession. This causes a few problems in my use-case (sending protobuf-formatted packets back and forth):
- The input is mirrored back in the output, useful in an interactive context but not for automation
- Sending arbitrary binary data can cause problems (like accidentally sending
\u001b which is escape in UTF16 or similar)
- A newline needs to be sent in order to actually commit input to the program
I've created a workaround for this that uses evil reflection hacks for sending stuff directly to SshCommand.
Proposed changes
- Expose
IChannelSession, IChannelSession and SshCommand._channel as public
or
- Add a public method to
SshCommand that calls _channel.SendData(byte[] data, int offset, int size)
I could create a PR for either solution, although I'm not sure yet how I would write a test for this.
By default you can't write to the Standard Input of a running
SshCommandand can only write to a process running in SSH by usingCreateShellSession. This causes a few problems in my use-case (sending protobuf-formatted packets back and forth):\u001bwhich is escape in UTF16 or similar)I've created a workaround for this that uses evil reflection hacks for sending stuff directly to
SshCommand.Proposed changes
IChannelSession,IChannelSessionandSshCommand._channelas publicor
SshCommandthat calls_channel.SendData(byte[] data, int offset, int size)I could create a PR for either solution, although I'm not sure yet how I would write a test for this.