client

package
v0.22.0 Latest Latest
Warning

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

Go to latest
Published: Jan 8, 2026 License: AGPL-3.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetSessionID

func GetSessionID() string

GetSessionID returns the process-wide session identifier used by this gotsr instance.

Types

type ClientStats

type ClientStats interface {
	// GetConnectionAttempts returns the number of connection attempts made.
	GetConnectionAttempts() int

	// GetLastError returns the last error encountered.
	GetLastError() error
}

ClientStats defines the interface for retrieving client statistics.

type CommandExecutor

type CommandExecutor interface {
	// ExecuteCommand runs a command and returns the output.
	ExecuteCommand(command string) string
}

CommandExecutor defines the interface for executing shell commands on the remote system.

type FileTransfer

type FileTransfer interface {
	// Upload sends a file from local to remote.
	Upload(localPath, remotePath string) error

	// Download retrieves a file from remote to local.
	Download(remotePath, localPath string) error
}

FileTransfer defines the interface for file operations (upload/download).

type ForwardHandler added in v0.20.0

type ForwardHandler struct {
	// contains filtered or unexported fields
}

ForwardHandler manages port forwarding on the client side

func NewForwardHandler added in v0.20.0

func NewForwardHandler(sendFunc func(string)) *ForwardHandler

NewForwardHandler creates a new forward handler

func (*ForwardHandler) Close added in v0.20.0

func (fh *ForwardHandler) Close()

Close closes all connections

func (*ForwardHandler) HandleForwardData added in v0.20.0

func (fh *ForwardHandler) HandleForwardData(fwdID, connID, encodedData string) error

HandleForwardData handles incoming FORWARD_DATA from server

func (*ForwardHandler) HandleForwardStart added in v0.20.0

func (fh *ForwardHandler) HandleForwardStart(fwdID, connID, targetAddr string) error

HandleForwardStart handles a FORWARD_START command

func (*ForwardHandler) HandleForwardStop added in v0.20.0

func (fh *ForwardHandler) HandleForwardStop(fwdID string)

HandleForwardStop handles FORWARD_STOP command

type ReverseClient

type ReverseClient struct {
	// contains filtered or unexported fields
}

ReverseClient represents a reverse shell client that connects to a listener and handles command execution and file transfers.

func NewReverseClient

func NewReverseClient(target, sharedSecret, certFingerprint string) *ReverseClient

NewReverseClient creates a new reverse shell client

func (*ReverseClient) Close

func (rc *ReverseClient) Close() error

Close closes the connection

func (*ReverseClient) Connect

func (rc *ReverseClient) Connect() error

Connect establishes a TLS connection to the listener

func (*ReverseClient) ExecuteCommand

func (rc *ReverseClient) ExecuteCommand(command string) string

ExecuteCommand executes a shell command and returns the output

func (*ReverseClient) HandleCommands

func (rc *ReverseClient) HandleCommands() error

HandleCommands listens for commands and executes them

func (*ReverseClient) IsConnected

func (rc *ReverseClient) IsConnected() bool

IsConnected returns whether the client is currently connected

type ReverseClientInterface

type ReverseClientInterface interface {
	// Connect establishes a connection to the listener.
	// Returns an error if the connection fails.
	Connect() error

	// HandleCommands enters the command processing loop.
	// Blocks until the connection is closed or an error occurs.
	HandleCommands() error

	// Close gracefully closes the connection to the listener.
	Close() error

	// IsConnected returns whether the client is currently connected.
	IsConnected() bool
}

ReverseClientInterface defines the interface for a reverse shell client that connects to a listener. It handles the full lifecycle of connecting to and communicating with a reverse shell listener.

type SocksHandler added in v0.20.0

type SocksHandler struct {
	// contains filtered or unexported fields
}

SocksHandler manages SOCKS5 connections on the client side

func NewSocksHandler added in v0.20.0

func NewSocksHandler(sendFunc func(string)) *SocksHandler

NewSocksHandler creates a new SOCKS handler

func (*SocksHandler) Close added in v0.20.0

func (sh *SocksHandler) Close()

Close closes all connections

func (*SocksHandler) HandleSocksClose added in v0.20.0

func (sh *SocksHandler) HandleSocksClose(socksID, connID string)

HandleSocksClose handles SOCKS_CLOSE command

func (*SocksHandler) HandleSocksConn added in v0.20.0

func (sh *SocksHandler) HandleSocksConn(socksID, connID, targetAddr string) error

HandleSocksConn handles a SOCKS_CONN command - connect to target

func (*SocksHandler) HandleSocksData added in v0.20.0

func (sh *SocksHandler) HandleSocksData(socksID, connID, encodedData string) error

HandleSocksData handles incoming SOCKS_DATA from server

func (*SocksHandler) HandleSocksStart added in v0.20.0

func (sh *SocksHandler) HandleSocksStart(socksID string) error

HandleSocksStart handles a SOCKS_START command

Jump to

Keyboard shortcuts

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