SSH .NET ShellStream 字符清理

SSH .NET ShellStream characters cleanup

我能够连接 SSH .NET 命令并将其推送到服务器,但是当我通过 PuTTy 连接时,我收到了一些我看不到的难以辨认的编码行。

赞:[4i[?4i[0;1234c

我们的 IT 人员说控制台需要设置为 VT320 或 VT400+。 但是我找不到有关此文档的任何详细信息。

SSH.NET是否支持此功能?

我已经尝试了 StreamReader 的所有编码类型。 我正在使用来自另一个 post 的代码来读取控制台:

 public static string SendCommand(string cmd, ShellStream sh)
        {
            StreamReader reader = null;
            try
            {
                reader = new StreamReader(sh, Encoding.Default);
                StreamWriter writer = new StreamWriter(sh, Encoding.Default);
                writer.AutoFlush = true;
                writer.WriteLine(cmd);
                while (sh.Length == 0)
                {
                    Thread.Sleep(1500);
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine("exception: " + ex.ToString());
            }

            return reader.ReadToEnd();
        }

看起来像 link 上的例子显示的格式和颜色。 echo -e "\033[47m3[1;37m 白色 \033[0m"

https://github.com/yonchu/shell-color-pallet/blob/master/color16