Documentation ¶
Overview ¶
Warning - This is generated code
Index ¶
- type SSHClient
- func (c *SSHClient) Close() (bool, error)
- func (c *SSHClient) Connect(host string, port int, username, password string) (bool, error)
- func (c *SSHClient) ConnectSSHInfoMode(host string, port int) (*ssh.HandshakeLog, error)
- func (c *SSHClient) ConnectWithKey(host string, port int, username, key string) (bool, error)
- func (c *SSHClient) Run(cmd string) (string, error)
- func (c *SSHClient) SetTimeout(sec int)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type SSHClient ¶
type SSHClient struct {
// contains filtered or unexported fields
}
SSHClient is a client for SSH servers. Internally client uses github.com/zmap/zgrab2/lib/ssh driver. @example ```javascript const ssh = require('nuclei/ssh'); const client = new ssh.SSHClient(); ```
func (*SSHClient) Close ¶
Close closes the SSH connection and destroys the client Returns the success state and error. If error is not nil, state will be false @example ```javascript const ssh = require('nuclei/ssh'); const client = new ssh.SSHClient(); client.Connect('acme.com', 22, 'username', 'password'); const closed = client.Close(); ```
func (*SSHClient) Connect ¶
Connect tries to connect to provided host and port with provided username and password with ssh. Returns state of connection and error. If error is not nil, state will be false @example ```javascript const ssh = require('nuclei/ssh'); const client = new ssh.SSHClient(); const connected = client.Connect('acme.com', 22, 'username', 'password'); ```
func (*SSHClient) ConnectSSHInfoMode ¶
ConnectSSHInfoMode tries to connect to provided host and port with provided host and port Returns HandshakeLog and error. If error is not nil, state will be false HandshakeLog is a struct that contains information about the ssh connection @example ```javascript const ssh = require('nuclei/ssh'); const client = new ssh.SSHClient(); const info = client.ConnectSSHInfoMode('acme.com', 22); log(to_json(info)); ```
func (*SSHClient) ConnectWithKey ¶
ConnectWithKey tries to connect to provided host and port with provided username and private_key. Returns state of connection and error. If error is not nil, state will be false @example ```javascript const ssh = require('nuclei/ssh'); const client = new ssh.SSHClient(); const privateKey = `-----BEGIN RSA PRIVATE KEY----- ...`; const connected = client.ConnectWithKey('acme.com', 22, 'username', privateKey); ```
func (*SSHClient) Run ¶
Run tries to open a new SSH session, then tries to execute the provided command in said session Returns string and error. If error is not nil, state will be false The string contains the command output @example ```javascript const ssh = require('nuclei/ssh'); const client = new ssh.SSHClient(); client.Connect('acme.com', 22, 'username', 'password'); const output = client.Run('id'); log(output); ```
func (*SSHClient) SetTimeout ¶
SetTimeout sets the timeout for the SSH connection in seconds @example ```javascript const ssh = require('nuclei/ssh'); const client = new ssh.SSHClient(); client.SetTimeout(10); ```