Agent plugins are able to connect with remote devices using secure shell (SSH) version 2 and transfer files with the built-in SftpSupport class, accessible through the Sftp property.



IsConnected

Determines whether the SFTP system is connected and authenticated.


Connect

It is recommended to use the existing connection, however if the SFTP system is not already connected the following method can be used to connect to the SSH server.

The password will be stored in the code of the plugin in plain text.


SshConnectionSettings settings = new SshConnectionSettings();
settings.Enabled = true;
settings.Credentials.UseDefaultCredentials = false;
settings.Credentials.Username = "admin";
settings.Credentials.Password.SetPassword("password");
Sftp.Connect("demo-srv01", settings);

Disconnect

Disconnects from the remote SSH host. This is done automatically by the system when the scan completes.


Dispose

Disconnects from the remote SSH host, and disposes of the connection. This is done automatically by the system when the scan completes.


ExecuteCommand

Executes the specified command and returns the response.


FileExists

Determines whether a file at the specified path exists.


GetFileInformation

Returns the information about the file at the specified path such as creation date, last modified date, owner, and file size.


GetFileSize

Returns the size of the file at the specified path in bytes.


GetTextFileContents

Returns the contents of the text file at the specified path.


Settings

The settings used to establish the SFTP connection over SSH.