简体   繁体   English

使用 C# 中的 SSH 协议混淆从 Bitvise SFTP 服务器连接和下载文件

[英]Connect and download files from Bitvise SFTP server with SSH protocol obfuscation in C#

I have SFTP server which is able to connect via (Bitvise SSH client) with the help of Obfuscation Password.我有 SFTP 服务器,它能够在混淆密码的帮助下通过(Bitvise SSH 客户端)进行连接。 But, unable to connect the same via c# code.但是,无法通过 c# 代码连接。

Here is my code:这是我的代码:

winSCPSrc.SessionOptions sessionOptionss = new winSCPSrc.SessionOptions();
sessionOptionss.Protocol = winSCPSrc.Protocol.Sftp;
sessionOptionss.PortNumber = Port;
sessionOptionss.HostName = Host;
sessionOptionss.UserName = Username;
if (!string.IsNullOrEmpty(Password))
{
    sessionOptionss.Password = Password;
}
//sessionOptionss.GiveUpSecurityAndAcceptAnySshHostKey = true;
sessionOptionss.SshHostKeyFingerprint = fingerPrint;

using (winSCPSrc.Session session = new winSCPSrc.Session())
{
    State.KPILog.Info(" SFTP Connection trying to Open ");
    session.AddRawConfiguration("DefaultConfiguration", "false");
    // Connect
    session.Open(sessionOptionss);
    State.KPILog.Info("SFTP Connection Open ");
    // ...
}

I'm getting "Server unexpectedly closed network connection" error while session.Open(sessionOptionss) .我在session.Open(sessionOptionss)时收到“服务器意外关闭网络连接”错误。

Please let me know there is any other libraries available other than winscp to connect SFTP.请让我知道除了 winscp 之外还有任何其他可用的库来连接 SFTP。

What I have tried:我尝试过的:

  • Able to connect and download files via Bitvise SSH client but unable to implement it in C# code.能够通过 Bitvise SSH 客户端连接和下载文件,但无法在 C# 代码中实现。

  • Our IT provider has given some "Obfuscation Password" for connecting via Bitvise ssh client.我们的 IT 提供商提供了一些“混淆密码”,用于通过 Bitvise ssh 客户端进行连接。 I have no idea how it works in C# code.我不知道它在 C# 代码中是如何工作的。

Bitvise FAQ says ( emphasis mine): Bitvise 常见问题解答说(强调我的):

If all of your legitimate connections come from Bitvise SSH Client, you can enable SSH protocol obfuscation in the SSH Server in Advanced settings, under Bindings and UPnP.如果您的所有合法连接都来自 Bitvise SSH 客户端,您可以在 SSH 服务器的高级设置中的绑定和 UPnP 下启用 SSH 协议混淆。 If you enable obfuscation, only Bitvise SSH Client will be able to connect , and then only if configured with the correct obfuscation keyword.如果启用混淆,则只有 Bitvise SSH 客户端才能连接,并且只有配置了正确的混淆关键字。

It seems that the "obfuscation" is a proprietary feature of Bitvise.似乎“混淆”是 Bitvise 的专有功能。 So it's likely that Bitvise products support it only.所以很可能 Bitvise 产品只支持它。 Bitvise has FlowSsh library . Bitvise 有FlowSsh 库 As Bitvise client is apparently built on top of the library, you should be able to use the library from your C# code.由于 Bitvise 客户端显然是建立在库之上的,因此您应该能够从 C# 代码中使用该库。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM