Documentation
¶
Index ¶
- type CommandHandler
- type Listener
- func (l *Listener) EnterPtyMode(clientAddr string) (chan []byte, error)
- func (l *Listener) ExitPtyMode(clientAddr string) error
- func (l *Listener) GetClientAddressesSorted() []string
- func (l *Listener) GetClientIdentifier(clientAddr string) string
- func (l *Listener) GetClients() []string
- func (l *Listener) GetPtyDataChan(clientAddr string) (chan []byte, bool)
- func (l *Listener) GetResponse(clientAddr string, timeout time.Duration) (string, error)
- func (l *Listener) IsInPtyMode(clientAddr string) bool
- func (l *Listener) SendCommand(clientAddr, cmd string) error
- func (l *Listener) Start() (net.Listener, error)
- type ListenerInterface
- type ListenerStats
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CommandHandler ¶
type CommandHandler interface {
// ExecuteCommand sends a command and gets the response.
ExecuteCommand(cmd string) (string, error)
// IsConnected checks if the command handler has an active connection.
IsConnected() bool
}
CommandHandler defines the interface for handling command execution on clients.
type Listener ¶
type Listener struct {
// contains filtered or unexported fields
}
Listener represents a TLS reverse shell listener server that accepts client connections, manages them, and dispatches commands to connected clients.
func NewListener ¶
func NewListener(port, networkInterface string, tlsConfig *tls.Config, sharedSecret string) *Listener
NewListener creates a new reverse shell listener with the given port, network interface, TLS configuration, and optional shared secret.
func (*Listener) EnterPtyMode ¶
EnterPtyMode puts a client into PTY mode for interactive shell
func (*Listener) ExitPtyMode ¶
ExitPtyMode exits PTY mode for a client
func (*Listener) GetClientAddressesSorted ¶
GetClientAddressSorted returns sorted client addresses for consistent ordering
func (*Listener) GetClientIdentifier ¶
GetClientIdentifier returns the short identifier for a client if present.
func (*Listener) GetClients ¶
GetClients returns a list of currently connected client addresses.
func (*Listener) GetPtyDataChan ¶
GetPtyDataChan returns the PTY data channel for a client
func (*Listener) GetResponse ¶
GetResponse waits for and returns the response from a client within the given timeout. It returns an error if the client is not found or if the timeout is exceeded.
func (*Listener) IsInPtyMode ¶
IsInPtyMode checks if a client is in PTY mode
func (*Listener) SendCommand ¶
SendCommand sends a command to a specific client identified by its address. It returns an error if the client is not found or if the send times out.
type ListenerInterface ¶
type ListenerInterface interface {
// Start begins listening for incoming client connections.
// Returns the underlying net.Listener and any error that occurred.
Start() (net.Listener, error)
// GetClients returns a list of currently connected client addresses.
GetClients() []string
// SendCommand sends a command to a specific client by its address.
// Returns an error if the client is not connected or the send fails.
SendCommand(clientAddr, cmd string) error
// GetResponse waits for and retrieves the response from a specific client.
// Blocks until a response is available or timeout is exceeded.
GetResponse(clientAddr string, timeout time.Duration) (string, error)
// GetClientAddressesSorted returns a sorted list of connected client addresses.
GetClientAddressesSorted() []string
// GetClientIdentifier returns the short identifier for a client if present.
// Returns empty string when no identifier was announced.
GetClientIdentifier(clientAddr string) string
// EnterPtyMode enters interactive PTY mode with a specific client.
// Returns a channel that receives PTY data, or an error if mode entry fails.
EnterPtyMode(clientAddr string) (chan []byte, error)
// ExitPtyMode exits interactive PTY mode with a specific client.
ExitPtyMode(clientAddr string) error
// IsInPtyMode checks if a specific client is in PTY mode.
IsInPtyMode(clientAddr string) bool
// GetPtyDataChan retrieves the data channel for a client in PTY mode.
GetPtyDataChan(clientAddr string) (chan []byte, bool)
}
ListenerInterface defines the interface for a TLS listener that manages reverse shell client connections. It handles accepting client connections, managing the client pool, and executing commands on clients.
type ListenerStats ¶
type ListenerStats interface {
// GetClientCount returns the number of currently connected clients.
GetClientCount() int
// GetTotalConnections returns the total number of connections made since startup.
GetTotalConnections() int
// GetLastError returns the last error that occurred.
GetLastError() error
}
ListenerStats defines the interface for retrieving listener statistics.