console

package
v1.6.2 Latest Latest
Warning

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

Go to latest
Published: Jan 8, 2026 License: GPL-3.0 Imports: 29 Imported by: 50

README

client/console

Overview

Renders the interactive console UI, logging, and terminal helpers for the client. Coordinates readline behavior, prompt styling, and message formatting.

Go Files

  • console.go – Implements the interactive console, prompt rendering, and RPC client integration.
  • log.go – Provides structured logging utilities and output filters tailored to the console experience.

Documentation

Index

Constants

View Source
const (
	// ANSI Colors.
	Normal    = "\033[0m"
	Black     = "\033[30m"
	Red       = "\033[31m"
	Green     = "\033[32m"
	Orange    = "\033[33m"
	Blue      = "\033[34m"
	Purple    = "\033[35m"
	Cyan      = "\033[36m"
	Gray      = "\033[37m"
	Bold      = "\033[1m"
	Clearln   = "\r\x1b[2K"
	UpN       = "\033[%dA"
	DownN     = "\033[%dB"
	Underline = "\033[4m"

	// Info - Display colorful information.
	Info = Bold + Cyan + "[*] " + Normal
	// Warn - Warn a user.
	Warn = Bold + Red + "[!] " + Normal
	// Debug - Display debug information.
	Debug = Bold + Purple + "[-] " + Normal
	// Woot - Display success.
	Woot = Bold + Green + "[$] " + Normal
	// Success - Diplay success.
	Success = Bold + Green + "[+] " + Normal
)

Variables

This section is empty.

Functions

func StartClient added in v1.6.0

func StartClient(con *SliverClient, rpc rpcpb.SliverRPCClient, serverCmds, sliverCmds console.Commands, run bool, rcScript string) error

Init requires a working RPC connection to the sliver server, and 2 different sets of commands. If run is true, the console application is started, making this call blocking. Otherwise, commands and RPC connection are bound to the console (making the console ready to run), but the console does not start.

Types

type ActiveTarget added in v1.5.0

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

func (*ActiveTarget) AddObserver added in v1.5.0

func (s *ActiveTarget) AddObserver(observer Observer) int

AddObserver - Observers to notify when the active session changes

func (*ActiveTarget) Background added in v1.5.0

func (s *ActiveTarget) Background()

Background - Background the active session.

func (*ActiveTarget) Get added in v1.5.0

GetSessionInteractive - Get the active target(s).

func (*ActiveTarget) GetBeacon added in v1.5.0

func (s *ActiveTarget) GetBeacon() *clientpb.Beacon

GetBeacon - Same as GetBeacon() but doesn't print a warning.

func (*ActiveTarget) GetBeaconInteractive added in v1.5.0

func (s *ActiveTarget) GetBeaconInteractive() *clientpb.Beacon

GetBeaconInteractive - Get beacon interactive the active session.

func (*ActiveTarget) GetHostUUID added in v1.6.0

func (s *ActiveTarget) GetHostUUID() string

GetHostUUID - Get the Host's UUID (ID in the database)

func (*ActiveTarget) GetInteractive added in v1.5.0

func (s *ActiveTarget) GetInteractive() (*clientpb.Session, *clientpb.Beacon)

GetSessionInteractive - Get the active target(s).

func (*ActiveTarget) GetSession added in v1.5.0

func (s *ActiveTarget) GetSession() *clientpb.Session

GetSession - Same as GetSession() but doesn't print a warning.

func (*ActiveTarget) GetSessionInteractive added in v1.5.0

func (s *ActiveTarget) GetSessionInteractive() *clientpb.Session

GetSessionInteractive - GetSessionInteractive the active session.

func (*ActiveTarget) IsBeacon added in v1.6.0

func (s *ActiveTarget) IsBeacon() bool

IsBeacon - Is the current target a beacon?

func (*ActiveTarget) IsSession added in v1.5.0

func (s *ActiveTarget) IsSession() bool

IsSession - Is the current target a session?

func (*ActiveTarget) RemoveObserver added in v1.5.0

func (s *ActiveTarget) RemoveObserver(observerID int)

func (*ActiveTarget) Request added in v1.5.0

func (s *ActiveTarget) Request(cmd *cobra.Command) *commonpb.Request

func (*ActiveTarget) Set added in v1.5.0

func (s *ActiveTarget) Set(session *clientpb.Session, beacon *clientpb.Beacon)

Set - Change the active session.

type BeaconTaskCallback added in v1.5.0

type BeaconTaskCallback func(*clientpb.BeaconTask)

Observer - A function to call when the sessions changes.

type ConsoleClientLogger added in v1.6.0

type ConsoleClientLogger struct {
	Stream rpcpb.SliverRPC_ClientLogClient
	// contains filtered or unexported fields
}

ConsoleClientLogger is an io.Writer that sends data to the server.

func (*ConsoleClientLogger) Write added in v1.6.0

func (l *ConsoleClientLogger) Write(buf []byte) (int, error)

type Observer added in v1.4.18

type Observer func(*clientpb.Session, *clientpb.Beacon)

Observer - A function to call when the sessions changes.

type SliverClient added in v1.6.0

type SliverClient struct {
	App                      *console.Console
	Rpc                      rpcpb.SliverRPCClient
	ActiveTarget             *ActiveTarget
	EventListeners           *sync.Map
	BeaconTaskCallbacks      map[string]BeaconTaskCallback
	BeaconTaskCallbacksMutex *sync.Mutex
	Settings                 *assets.ClientSettings
	IsServer                 bool
	IsCLI                    bool
	// contains filtered or unexported fields
}

func NewConsole added in v1.6.0

func NewConsole(isServer bool) *SliverClient

NewConsole creates the sliver client (and console), creating menus and prompts. The returned console does neither have commands nor a working RPC connection yet, thus has not started monitoring any server events, or started the application.

func (*SliverClient) AddBeaconCallback added in v1.6.0

func (con *SliverClient) AddBeaconCallback(taskID string, callback BeaconTaskCallback)

func (*SliverClient) CheckLastUpdate added in v1.6.0

func (con *SliverClient) CheckLastUpdate()

func (*SliverClient) ClientLogStream added in v1.6.0

func (con *SliverClient) ClientLogStream(name string) (*ConsoleClientLogger, error)

ClientLogStream requires a log stream name, used to save the logs going through this stream in a specific log subdirectory/file.

func (*SliverClient) CreateEventListener added in v1.6.0

func (con *SliverClient) CreateEventListener() (string, <-chan *clientpb.Event)

CreateEventListener - creates a new event listener and returns its ID.

func (*SliverClient) ExposeCommands added in v1.6.0

func (con *SliverClient) ExposeCommands()

Expose or hide commands if the active target does support them (or not). Ex; hide Windows commands on Linux implants, Wireguard tools on HTTP C2, etc.

func (*SliverClient) FlushOutput added in v1.6.2

func (con *SliverClient) FlushOutput()

FlushOutput drains any piped stdout before exiting.

func (*SliverClient) FormatDateDelta added in v1.6.0

func (con *SliverClient) FormatDateDelta(t time.Time, includeDate bool, color bool) string

FormatDateDelta - Generate formatted date string of the time delta between then and now.

func (*SliverClient) GetActiveBeaconConfig added in v1.6.0

func (con *SliverClient) GetActiveBeaconConfig() *clientpb.ImplantConfig

func (*SliverClient) GetActiveSessionConfig added in v1.6.0

func (con *SliverClient) GetActiveSessionConfig() *clientpb.ImplantConfig

GetActiveSessionConfig - Get the active sessions's config TODO: Switch to query config based on ConfigID.

func (*SliverClient) GetPrompt added in v1.6.0

func (con *SliverClient) GetPrompt() string

func (*SliverClient) GetSession added in v1.6.0

func (con *SliverClient) GetSession(arg string) *clientpb.Session

func (*SliverClient) GetSessionsByName added in v1.6.0

func (con *SliverClient) GetSessionsByName(name string) []*clientpb.Session

GetSessionsByName - Return all sessions for an Implant by name.

func (*SliverClient) GrpcContext added in v1.6.0

func (con *SliverClient) GrpcContext(cmd *cobra.Command) (context.Context, context.CancelFunc)

GrpcContext - Generate a context for a GRPC request, if no grumble context or an invalid flag is provided 60 seconds is used instead.

func (*SliverClient) PrintAsyncResponse added in v1.6.0

func (con *SliverClient) PrintAsyncResponse(resp *commonpb.Response)

PrintAsyncResponse - Print the generic async response information.

func (*SliverClient) PrintErrorf added in v1.6.0

func (con *SliverClient) PrintErrorf(format string, args ...any)

PrintErrorf prints an error message immediately below the last line of output.

func (*SliverClient) PrintEventErrorf added in v1.6.0

func (con *SliverClient) PrintEventErrorf(format string, args ...any)

PrintEventErrorf prints an error message with a leading/trailing newline for emphasis.

func (*SliverClient) PrintEventInfof added in v1.6.0

func (con *SliverClient) PrintEventInfof(format string, args ...any)

PrintEventInfof prints an info message with a leading/trailing newline for emphasis.

func (*SliverClient) PrintEventSuccessf added in v1.6.0

func (con *SliverClient) PrintEventSuccessf(format string, args ...any)

PrintEventSuccessf a success message with a leading/trailing newline for emphasis.

func (*SliverClient) PrintInfof added in v1.6.0

func (con *SliverClient) PrintInfof(format string, args ...any)

PrintInfof prints an info message immediately below the last line of output.

func (con *SliverClient) PrintLogo()

func (*SliverClient) PrintSuccessf added in v1.6.0

func (con *SliverClient) PrintSuccessf(format string, args ...any)

PrintSuccessf prints a success message immediately below the last line of output.

func (*SliverClient) PrintWarnf added in v1.6.0

func (con *SliverClient) PrintWarnf(format string, args ...any)

PrintWarnf a warning message immediately below the last line of output.

func (*SliverClient) Printf added in v1.6.0

func (con *SliverClient) Printf(format string, args ...any)

func (*SliverClient) Println added in v1.6.0

func (con *SliverClient) Println(args ...any)

Println prints an output without status and immediately below the last line of output.

func (*SliverClient) RemoveEventListener added in v1.6.0

func (con *SliverClient) RemoveEventListener(listenerID string)

RemoveEventListener - removes an event listener given its id.

func (*SliverClient) SpinUntil added in v1.6.0

func (con *SliverClient) SpinUntil(message string, ctrl chan bool)

Jump to

Keyboard shortcuts

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