Skip to content

Allow writing to SshCommand #802

Closed
Closed
@blenderfreaky

Description

@blenderfreaky

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions