ssh

(ssh).SSHClient

SSHClient is a client for SSH servers. Internally client uses github.com/zmap/zgrab2/lib/ssh driver. Kind: inner class of ssh

sshClient.Close() ⇒ boolean

Close closes the SSH connection and destroys the client Kind: instance method of SSHClient
Returns: boolean - - The success state of the operation.
Throws:
  • error - The error encountered during the operation.
Example
let m = require('nuclei/ssh');
    let c = m.SSHClient();
    let state = c.Connect('localhost', 22, 'user', 'password');
    let result = c.Close();

sshClient.Connect(host, port, username, password) ⇒ boolean

Connect tries to connect to provided host and port with provided username and password with ssh. Kind: instance method of SSHClient
Returns: boolean - - The success state of the operation.
Throws:
  • error - The error encountered during the operation.
ParamTypeDescription
hoststringThe host to connect to.
portnumberThe port to connect to.
usernamestringThe username for the connection.
passwordstringThe password for the connection.
Example
let m = require('nuclei/ssh');
    let c = m.SSHClient();
    let result = c.Connect('localhost', 22, 'user', 'password');

sshClient.ConnectSSHInfoMode(host, port) ⇒ HandshakeLog

ConnectSSHInfoMode tries to connect to provided host and port with provided host and port Kind: instance method of SSHClient
Returns: HandshakeLog - - The HandshakeLog object containing information about the ssh connection.
Throws:
  • error - The error encountered during the operation.
ParamTypeDescription
hoststringThe host to connect to.
portnumberThe port to connect to.
Example
let m = require('nuclei/ssh');
    let c = m.SSHClient();
    let result = c.ConnectSSHInfoMode('localhost', 22);

sshClient.ConnectWithKey(host, port, username, key) ⇒ boolean

ConnectWithKey tries to connect to provided host and port with provided username and private_key. Kind: instance method of SSHClient
Returns: boolean - - The success state of the operation.
Throws:
  • error - The error encountered during the operation.
ParamTypeDescription
hoststringThe host to connect to.
portnumberThe port to connect to.
usernamestringThe username for the connection.
keystringThe private key for the connection.
Example
let m = require('nuclei/ssh');
    let c = m.SSHClient();
    let result = c.ConnectWithKey('localhost', 22, 'user', 'key');

sshClient.Run(cmd) ⇒ string

Run tries to open a new SSH session, then tries to execute the provided command in said session Kind: instance method of SSHClient
Returns: string - - The output of the command.
Throws:
  • error - The error encountered during the operation.
ParamTypeDescription
cmdstringThe command to execute.
Example
let m = require('nuclei/ssh');
    let c = m.SSHClient();
    let result = c.Run('ls');

sshClient.SetTimeout(sec)

SetTimeout sets the timeout for the SSH connection in seconds Kind: instance method of SSHClient
ParamTypeDescription
secnumberThe number of seconds for the timeout.
Example
let m = require('nuclei/ssh');
    let c = m.SSHClient();
    c.SetTimeout(30);

(ssh).HandshakeLog : object

HandshakeLog is a struct that contains information about the ssh connection. Kind: inner typedef of ssh