Class RemoteShell
Allows in/out operations and/or data validations with a remote computer (like ssh, scp, etc.).
Implements
Inherited Members
Namespace: AutoCheck.Core.Connectors
Assembly: AutoCheck.dll
Syntax
public class RemoteShell : LocalShell, IDisposable
Constructors
| Improve this Doc View SourceRemoteShell(OS, String, String, String, Int32)
Declaration
public RemoteShell(OS remoteOS, string host, string username, string password, int port = 22)
Parameters
Type | Name | Description |
---|---|---|
AutoCheck.Core.OS | remoteOS | |
System.String | host | |
System.String | username | |
System.String | password | |
System.Int32 | port |
Properties
| Improve this Doc View SourceHost
The remote host address.
Declaration
public string Host { get; }
Property Value
Type | Description |
---|---|
System.String |
Password
The remote host password used to login.
Declaration
public string Password { get; }
Property Value
Type | Description |
---|---|
System.String |
Port
The remote host port, where SSH is listening to.
Declaration
public int Port { get; }
Property Value
Type | Description |
---|---|
System.Int32 |
RemoteOS
The remote host OS.
Declaration
public OS RemoteOS { get; }
Property Value
Type | Description |
---|---|
AutoCheck.Core.OS |
Shell
The SSH client used to send remote commands.
Declaration
public SshClient Shell { get; }
Property Value
Type | Description |
---|---|
Renci.SshNet.SshClient |
Username
The remote host username used to login.
Declaration
public string Username { get; }
Property Value
Type | Description |
---|---|
System.String |
Methods
| Improve this Doc View SourceCountFiles(String, Boolean)
Returns how many files has been found within the given path.
Declaration
public override int CountFiles(string path, bool recursive = true)
Parameters
Type | Name | Description |
---|---|---|
System.String | path | Path where the files will be searched into. |
System.Boolean | recursive | Recursive deep search. |
Returns
Type | Description |
---|---|
System.Int32 | The amount of files. |
Overrides
| Improve this Doc View SourceCountFolders(String, Boolean)
Returns how many folders has been found within the given path.
Declaration
public override int CountFolders(string path, bool recursive = true)
Parameters
Type | Name | Description |
---|---|---|
System.String | path | Path where the folders will be searched into. |
System.Boolean | recursive | Recursive deep search. |
Returns
Type | Description |
---|---|
System.Int32 | The amount of folders. |
Overrides
| Improve this Doc View SourceDispose()
Disposes the object releasing its unmanaged properties.
Declaration
public override void Dispose()
Overrides
| Improve this Doc View SourceGetFile(String, String, Boolean)
Returns a file full path if exists.
Declaration
public override string GetFile(string path, string file, bool recursive = true)
Parameters
Type | Name | Description |
---|---|---|
System.String | path | Path where the file will be searched into. |
System.String | file | The file to search. |
System.Boolean | recursive | Recursive deep search. |
Returns
Type | Description |
---|---|
System.String | Folder's full path, NULL if does not exists. |
Overrides
| Improve this Doc View SourceGetFolder(String, String, Boolean)
Returns a folder full path if exists.
Declaration
public override string GetFolder(string path, string folder, bool recursive = true)
Parameters
Type | Name | Description |
---|---|---|
System.String | path | Path where the folder will be searched into. |
System.String | folder | The folder to search. |
System.Boolean | recursive | Recursive deep search. |
Returns
Type | Description |
---|---|
System.String | Folder's full path, NULL if does not exists. |
Overrides
| Improve this Doc View SourceRunCommand(String, String)
Runs a remote shell command.
Declaration
public override (int code, string response) RunCommand(string command, string path = "")
Parameters
Type | Name | Description |
---|---|---|
System.String | command | The command to run. |
System.String | path |
Returns
Type | Description |
---|---|
System.ValueTuple<System.Int32, System.String> | The return code and the complete response. |
Overrides
| Improve this Doc View SourceTestConnection()
Test the connection to the remote host, so an exception will be thrown if any problem occurs.
Declaration
public void TestConnection()