console

package
v1.0.11 Latest Latest
Warning

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

Go to latest
Published: Jul 15, 2024 License: GPL-3.0 Imports: 28 Imported by: 0

README

Console (Client)

Contains the entrypoint for the console client

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

func StartClient(con *SliverClient, rpc rpcpb.SliverRPCClient, serverCmds, sliverCmds console.Commands, run bool) 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

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

func (*ActiveTarget) AddObserver

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

AddObserver - Observers to notify when the active session changes

func (*ActiveTarget) Background

func (s *ActiveTarget) Background()

Background - Background the active session.

func (*ActiveTarget) Get

GetSessionInteractive - Get the active target(s).

func (*ActiveTarget) GetBeacon

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

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

func (*ActiveTarget) GetBeaconInteractive

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

GetBeaconInteractive - Get beacon interactive the active session.

func (*ActiveTarget) GetHostUUID

func (s *ActiveTarget) GetHostUUID() string

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

func (*ActiveTarget) GetInteractive

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

GetSessionInteractive - Get the active target(s).

func (*ActiveTarget) GetSession

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

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

func (*ActiveTarget) GetSessionInteractive

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

GetSessionInteractive - GetSessionInteractive the active session.

func (*ActiveTarget) IsBeacon

func (s *ActiveTarget) IsBeacon() bool

IsBeacon - Is the current target a beacon?

func (*ActiveTarget) IsSession

func (s *ActiveTarget) IsSession() bool

IsSession - Is the current target a session?

func (*ActiveTarget) RemoveObserver

func (s *ActiveTarget) RemoveObserver(observerID int)

func (*ActiveTarget) Request

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

func (*ActiveTarget) Set

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

Set - Change the active session.

type BeaconTaskCallback

type BeaconTaskCallback func(*clientpb.BeaconTask)

Observer - A function to call when the sessions changes.

type ConsoleClientLogger

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

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

type Observer

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

Observer - A function to call when the sessions changes.

type SliverClient

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

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

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

func (*SliverClient) CheckLastUpdate

func (con *SliverClient) CheckLastUpdate()

func (*SliverClient) ClientLogStream

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

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

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

func (*SliverClient) ExposeCommands

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) FormatDateDelta

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

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

func (*SliverClient) GetActiveSessionConfig

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

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

func (*SliverClient) GetPrompt

func (con *SliverClient) GetPrompt() string

func (*SliverClient) GetSession

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

func (*SliverClient) GetSessionsByName

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

GetSessionsByName - Return all sessions for an Implant by name.

func (*SliverClient) GrpcContext

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

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

PrintAsyncResponse - Print the generic async response information.

func (*SliverClient) PrintErrorf

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

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

func (*SliverClient) PrintEventErrorf

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

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

func (*SliverClient) PrintEventInfof

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

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

func (*SliverClient) PrintEventSuccessf

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

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

func (*SliverClient) PrintInfof

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

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

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

func (*SliverClient) PrintWarnf

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

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

func (*SliverClient) Printf

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

func (*SliverClient) Println

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

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

func (*SliverClient) RemoveEventListener

func (con *SliverClient) RemoveEventListener(listenerID string)

RemoveEventListener - removes an event listener given its id.

func (*SliverClient) SpinUntil

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