core

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Nov 20, 2024 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	LogLevel = logs.Warn
	Log      = &Logger{Logger: logs.NewLogger(LogLevel)}
	MuteLog  = &Logger{Logger: logs.NewLogger(logs.Important + 1)}
)
View Source
var (
	NewLine                    = "\x1b[1E"
	Debug           logs.Level = 10
	Warn            logs.Level = 20
	Info            logs.Level = 30
	Error           logs.Level = 40
	Important       logs.Level = 50
	GroupStyle                 = lipgloss.NewStyle().Foreground(lipgloss.Color("#8BE9FD"))
	NameStyle                  = lipgloss.NewStyle().Foreground(lipgloss.Color("#FF79C6"))
	DefaultLogStyle            = map[logs.Level]string{
		Debug:     NewLine + termenv.String(tui.Rocket+"[+]").Bold().Background(tui.Blue).String() + " %s",
		Warn:      NewLine + termenv.String(tui.Zap+"[warn]").Bold().Background(tui.Yellow).String() + " %s",
		Important: NewLine + termenv.String(tui.Fire+"[*]").Bold().Background(tui.Purple).String() + " %s",
		Info:      NewLine + termenv.String(tui.HotSpring+"[i]").Bold().Background(tui.Green).String() + " %s",
		Error:     NewLine + termenv.String(tui.Monster+"[-]").Bold().Background(tui.Red).String() + " %s",
	}
)

Functions

func HandleTaskContext added in v0.0.3

func HandleTaskContext(log *Logger, context *clientpb.TaskContext, fn *intermediate.InternalFunc, writeToFile bool, logPath string) error

Types

type ActiveTarget

type ActiveTarget struct {
	Session  *Session
	Observer *Observer
}

func (*ActiveTarget) Background

func (s *ActiveTarget) Background()

Background - Background the active session

func (*ActiveTarget) Context

func (s *ActiveTarget) Context() context.Context

func (*ActiveTarget) Get

func (s *ActiveTarget) Get() *Session

GetSessionInteractive - Get the active target(s)

func (*ActiveTarget) GetInteractive

func (s *ActiveTarget) GetInteractive() *Session

func (*ActiveTarget) Set

func (s *ActiveTarget) Set(session *Session)

Set - Change the active session

type Logger

type Logger struct {
	*logs.Logger
}

type Observer

type Observer struct {
	*Session
	Log *Logger
}

Observer - A function to call when the sessions changes

func NewObserver

func NewObserver(session *Session) *Observer

func (*Observer) SessionId

func (o *Observer) SessionId() string

type Rpc added in v0.0.3

type ServerStatus

type ServerStatus struct {
	*Rpc
	Info   *clientpb.Basic
	Client *clientpb.Client
	*ActiveTarget
	Clients   []*clientpb.Client
	Listeners []*clientpb.Listener
	Sessions  map[string]*Session
	Observers map[string]*Observer

	EventStatus bool
	EventHook   map[intermediate.EventCondition][]intermediate.OnEventFunc
	// contains filtered or unexported fields
}

func InitServerStatus

func InitServerStatus(conn *grpc.ClientConn, config *mtls.ClientConfig) (*ServerStatus, error)

func (*ServerStatus) AddCallback

func (s *ServerStatus) AddCallback(task *clientpb.Task, callback TaskCallback)

func (*ServerStatus) AddDoneCallback

func (s *ServerStatus) AddDoneCallback(task *clientpb.Task, callback TaskCallback)

func (*ServerStatus) AddEventHook added in v0.0.3

func (s *ServerStatus) AddEventHook(event intermediate.EventCondition, callback intermediate.OnEventFunc)

func (*ServerStatus) AddObserver

func (s *ServerStatus) AddObserver(session *Session) string

func (*ServerStatus) AddSession added in v0.0.3

func (s *ServerStatus) AddSession(sess *clientpb.Session)

func (*ServerStatus) AlivedSessions

func (s *ServerStatus) AlivedSessions() []*clientpb.Session

func (*ServerStatus) EventHandler

func (s *ServerStatus) EventHandler()

func (*ServerStatus) ObserverLog

func (s *ServerStatus) ObserverLog(sessionId string) *Logger

func (*ServerStatus) RemoveObserver

func (s *ServerStatus) RemoveObserver(observerID string)

func (*ServerStatus) UpdateListener added in v0.0.3

func (s *ServerStatus) UpdateListener() error

func (*ServerStatus) UpdateSession

func (s *ServerStatus) UpdateSession(sid string) (*Session, error)

func (*ServerStatus) UpdateSessions

func (s *ServerStatus) UpdateSessions(all bool) error

func (*ServerStatus) UpdateTasks

func (s *ServerStatus) UpdateTasks(session *Session) error

type Session

type Session struct {
	*clientpb.Session
	Server *ServerStatus
	Callee string // cmd/mal/sdk
}

func NewSession

func NewSession(sess *clientpb.Session, server *ServerStatus) *Session

func (*Session) Clone added in v0.0.3

func (s *Session) Clone(callee string) *Session

func (*Session) Console

func (s *Session) Console(task *clientpb.Task, msg string)

func (*Session) Context

func (s *Session) Context() context.Context

func (*Session) Error

func (s *Session) Error(task *clientpb.Task, err error)

func (*Session) GetAddon

func (s *Session) GetAddon(name string) *implantpb.Addon

func (*Session) GetHistory added in v0.0.3

func (s *Session) GetHistory()

func (*Session) HasAddon

func (s *Session) HasAddon(addon string) bool

func (*Session) HasDepend

func (s *Session) HasDepend(module string) bool

func (*Session) HasTask

func (s *Session) HasTask(taskId uint32) bool

type TaskCallback

type TaskCallback func(resp *implantpb.Spite)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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