资源简介
Renci.SshNet测试小例子,连接SSH,执行Linux命令,并返回执行结果。
当然还有很多功能,需要网上资源使用
代码片段和文件信息
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
SshExecHelper sshHelper = new SshExecHelper(“10.3.3.1“ “root“ “123456“ 22);
string sOutPut = string.Empty;
string sStdError = string.Empty;
string sCmd = “ls“;
int rs = sshHelper.runscript(sCmd ref sOutPut ref sStdError);
Console.WriteLine(“=================== RS ======================“);
Console.WriteLine(rs);
Console.WriteLine(“=================== sOutPut ======================“);
Console.WriteLine( sOutPut);
Console.WriteLine(“=================== sStdError ======================“);
Console.WriteLine( sStdError);
Console.ReadKey();
}
}
}
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 386 2015-04-10 11:03 ConsoleApplication1\ConsoleApplication1\app.config
文件 5632 2015-04-10 11:09 ConsoleApplication1\ConsoleApplication1\bin\Debug\ConsoleApplication1.exe
文件 386 2015-04-10 11:03 ConsoleApplication1\ConsoleApplication1\bin\Debug\ConsoleApplication1.exe.config
文件 15872 2015-04-10 11:09 ConsoleApplication1\ConsoleApplication1\bin\Debug\ConsoleApplication1.pdb
文件 22472 2015-04-10 11:09 ConsoleApplication1\ConsoleApplication1\bin\Debug\ConsoleApplication1.vshost.exe
文件 386 2015-04-10 11:03 ConsoleApplication1\ConsoleApplication1\bin\Debug\ConsoleApplication1.vshost.exe.config
文件 490 2012-06-06 02:06 ConsoleApplication1\ConsoleApplication1\bin\Debug\ConsoleApplication1.vshost.exe.manifest
文件 481280 2015-03-25 17:15 ConsoleApplication1\ConsoleApplication1\bin\Debug\Renci.SshNet.dll
文件 1371648 2015-03-25 17:15 ConsoleApplication1\ConsoleApplication1\bin\Debug\Renci.SshNet.pdb
文件 890331 2015-03-25 17:15 ConsoleApplication1\ConsoleApplication1\bin\Debug\Renci.SshNet.xm
文件 2833 2015-04-10 10:59 ConsoleApplication1\ConsoleApplication1\ConsoleApplication1.csproj
文件 1018 2015-04-10 11:09 ConsoleApplication1\ConsoleApplication1\obj\Debug\ConsoleApplication1.csproj.FileListAbsolute.txt
文件 7882 2015-04-10 11:08 ConsoleApplication1\ConsoleApplication1\obj\Debug\ConsoleApplication1.csprojResolveAssemblyReference.cache
文件 5632 2015-04-10 11:09 ConsoleApplication1\ConsoleApplication1\obj\Debug\ConsoleApplication1.exe
文件 15872 2015-04-10 11:09 ConsoleApplication1\ConsoleApplication1\obj\Debug\ConsoleApplication1.pdb
文件 6558 2015-04-10 10:59 ConsoleApplication1\ConsoleApplication1\obj\Debug\DesignTimeResolveAssemblyReferencesInput.cache
文件 937 2015-04-10 12:58 ConsoleApplication1\ConsoleApplication1\Program.cs
文件 1450 2015-04-10 10:51 ConsoleApplication1\ConsoleApplication1\Properties\AssemblyInfo.cs
文件 3865 2015-04-10 11:04 ConsoleApplication1\ConsoleApplication1\SshExecHelper.cs
文件 1437 2015-04-10 11:08 ConsoleApplication1\ConsoleApplication1.sln
..A..H. 59904 2015-04-10 12:57 ConsoleApplication1\ConsoleApplication1.v11.suo
文件 2184 2014-10-07 02:24 ConsoleApplication1\Renci.SshNet\AuthenticationMethod.cs
文件 525 2014-03-14 03:49 ConsoleApplication1\Renci.SshNet\AuthenticationResult.cs
文件 16236 2014-11-22 20:08 ConsoleApplication1\Renci.SshNet\ba
文件 481280 2015-03-25 17:15 ConsoleApplication1\Renci.SshNet\bin\Debug\Renci.SshNet.dll
文件 1371648 2015-03-25 17:15 ConsoleApplication1\Renci.SshNet\bin\Debug\Renci.SshNet.pdb
文件 890331 2015-03-25 17:15 ConsoleApplication1\Renci.SshNet\bin\Debug\Renci.SshNet.xm
文件 34947 2014-11-22 18:14 ConsoleApplication1\Renci.SshNet\Channels\Channel.cs
文件 12551 2014-11-17 00:59 ConsoleApplication1\Renci.SshNet\Channels\ChannelDirectTcpip.cs
文件 515 2014-10-27 03:05 ConsoleApplication1\Renci.SshNet\Channels\ChannelDirectTcpip.NET40.cs
............此处省略353个文件信息
评论
共有 条评论