Ssh.SSHClient
Class: SSHClient
ssh.SSHClient
SSHClient is a client for SSH servers. Internally client uses github.com/zmap/zgrab2/lib/ssh driver.
Example
Table of contents
Constructors
Methods
Constructors
constructor
• new SSHClient(): SSHClient
Returns
Defined in
ssh.ts:16
Methods
Close
▸ Close(): boolean
Close closes the SSH connection and destroys the client Returns the success state and error. If error is not nil, state will be false
Returns
boolean
Example
Defined in
ssh.ts:118
Connect
▸ Connect(host
, port
, username
): boolean
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
Parameters
Name | Type |
---|---|
host | string |
port | number |
username | string |
Returns
boolean
Example
Defined in
ssh.ts:43
ConnectSSHInfoMode
▸ ConnectSSHInfoMode(host
, port
): HandshakeLog
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
Parameters
Name | Type |
---|---|
host | string |
port | number |
Returns
Example
Defined in
ssh.ts:81
ConnectWithKey
▸ ConnectWithKey(host
, port
, username
): boolean
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
Parameters
Name | Type |
---|---|
host | string |
port | number |
username | string |
Returns
boolean
Example
Defined in
ssh.ts:61
Run
▸ Run(cmd
): string
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
Parameters
Name | Type |
---|---|
cmd | string |
Returns
string
Example
Defined in
ssh.ts:101
SetTimeout
▸ SetTimeout(sec
): void
SetTimeout sets the timeout for the SSH connection in seconds
Parameters
Name | Type |
---|---|
sec | number |
Returns
void
Example
Defined in
ssh.ts:26
Was this page helpful?