Documentation
¶
Overview ¶
Package sshtakeover provides an ssh.Client wrapper which provides utilities for taking over a machine over ssh, by uploading an executable and other payloads, and then executing the executable.
Index ¶
- type Client
- func (p *Client) Close() error
- func (p *Client) Execute(ctx context.Context, command string, stdin []byte) (stdout []byte, stderr []byte, err error)
- func (p *Client) SetProgress(callback func(int64))
- func (p *Client) Upload(ctx context.Context, targetPath string, src io.Reader) error
- func (p *Client) UploadExecutable(ctx context.Context, targetPath string, src io.Reader) error
- func (p *Client) UploadTree(ctx context.Context, targetPath string, tree structfs.Tree) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func (*Client) Execute ¶
func (p *Client) Execute(ctx context.Context, command string, stdin []byte) (stdout []byte, stderr []byte, err error)
Execute a given command on a remote host synchronously, passing in stdin as input, and returning a captured stdout/stderr. The returned data might be valid even when err != nil, which might happen if the remote side returned a non-zero exit code.
func (*Client) SetProgress ¶
SetProgress sets a callback which will be called repeatedly during uploads with a number of bytes that have been read.
func (*Client) UploadExecutable ¶
UploadExecutable uploads a given blob to a targetPath on the system and makes it executable.