gpt4 book ai didi

c# - Tamir.SharpSsh 重定向输出 (Sha1)

转载 作者:太空宇宙 更新时间:2023-11-03 12:53:35 24 4
gpt4 key购买 nike

我正在使用 Tmir.SharpSsh - SshExec 方法将一些命令发送到远程 SSH 服务器。

问题是这个方法或它创建的某个线程将输出发送到我的控制台窗口(“Sha1”)。

我想问问是否有人知道我可以禁用此打印或将其重定向到某个临时文件。

    public static bool OpenConnection (ConnectionInfo info)
{
string command = "nslookup " + info.IP + "| grep \"name = \" | awk -F\" = \" '{print $2}' | cut -d\".\" -f-1";
exec = new SshExec(info.IP, info.UserName,info.Password);

try
{

exec.Connect();
if (exec.Connected)
{
Console.WriteLine("Connection to {0} is successfully", info.IP);
info.Hostname=(exec.RunCommand(command)).Trim().ToUpper();//retrive Hostname from the RPA
return true;
}

else
return false;

}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
return false;
}

}

Console Output

最佳答案

您必须禁用行 Console.WriteLine("Sha1"); 到名为 public byte[] doFinal() 的方法中,在文件 中HMACSHA1.cs

关于c# - Tamir.SharpSsh 重定向输出 (Sha1),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34721898/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com