sshtakeover

package
v0.0.0-...-785df0d Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 24, 2025 License: Apache-2.0 Imports: 10 Imported by: 0

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

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 Dial

func Dial(ctx context.Context, address string, config *ssh.ClientConfig) (*Client, error)

Dial starts an ssh client connection.

func (*Client) Close

func (p *Client) Close() error

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

func (p *Client) SetProgress(callback func(int64))

SetProgress sets a callback which will be called repeatedly during uploads with a number of bytes that have been read.

func (*Client) Upload

func (p *Client) Upload(ctx context.Context, targetPath string, src io.Reader) error

Upload a given blob to a targetPath on the system.

func (*Client) UploadExecutable

func (p *Client) UploadExecutable(ctx context.Context, targetPath string, src io.Reader) error

UploadExecutable uploads a given blob to a targetPath on the system and makes it executable.

func (*Client) UploadTree

func (p *Client) UploadTree(ctx context.Context, targetPath string, tree structfs.Tree) error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
⌂ 换网址