SSH Support
Agent plugins are able to communicate with remote devices using secure shell (SSH) version 2 with the built-in SshSupport class, accessible through the Ssh property.
IsConnected
Determines whether the SSH system is connected and authenticated.
Connect
It is recommended to use the existing connection, however if the SSH 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);
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.
ExecuteUnixCommand
Executes the specified command and returns the response on a Unix system. The exit code is checked and an exception thrown if the command did not execute successfully. The method takes the useSudo parameter to determine if sudo should be used to execute the command.
Ssh.ExecuteUnixCommand("cat /etc/hosts", true);
ExecuteManualCommand
Executes the specified command and returns the response on a remote system that does not respond using industry standard new line characters.
Prompt
The command prompt currently displayed on the SSH host.
Settings
The settings used to establish the SSH connection.