Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type C2Bridge ¶
type C2Bridge interface {
WorkflowActivities // Embed the common workflow activities
// Name returns the name of the C2 server (e.g., "mythic", "cobaltstrike").
Name() string
// Initialize stores the client and other fields.
Initialize(ctx context.Context, harbingerClient messagesv1.HarbingerClient, c2ServerID string, settings *messagesv1.SettingsResponse) error
// InitializeC2 sets up the C2-specific client and performs any initial login/setup.
// SettingsResponse is provided by the base worker.
InitializeC2(ctx context.Context, settings *messagesv1.SettingsResponse) error
// RunC2SpecificReaders starts all C2-specific goroutines for reading data (tasks, outputs, etc.).
// It should use the provided context for cancellation and the WaitGroup for graceful shutdown.
RunC2SpecificReaders(ctx context.Context, wg *sync.WaitGroup)
// SendC2Status updates the C2 server's status.
// (This can be handled by the base worker, but kept here if C2-specific logic is needed).
SendC2Status(ctx context.Context, status string) error
// RefreshC2Session attempts to refresh the C2 session (e.g., re-authenticate).
RefreshC2Session() error
// Stop performs any necessary stop actions for the C2 bridge (e.g., closing subscriptions).
Stop() error
}
C2Bridge defines the interface that any specific C2 integration must implement. This decouples the generic worker logic from C2-specific interactions. It embeds the WorkflowActivities interface, meaning any C2Bridge must also implement SyncAll, RunJob, and WaitForTask.
type DefaultC2Bridge ¶
type DefaultC2Bridge struct {
HarbingerClient messagesv1.HarbingerClient
C2ServerID string
Settings *messagesv1.SettingsResponse // The fetched settings
}
DefaultC2Bridge provides common fields and a default InitializeC2 implementation. Concrete C2Bridge implementations can embed this struct.
func (*DefaultC2Bridge) Initialize ¶
func (d *DefaultC2Bridge) Initialize( ctx context.Context, harbingerClient messagesv1.HarbingerClient, c2ServerID string, settings *messagesv1.SettingsResponse, ) error
Initialize sets the common fields, no need to implement this yourself.
type FileResponse ¶
type FileResponse struct {
Host string `json:"host"`
IsFile bool `json:"is_file"`
Success bool `json:"success"`
Permissions struct{} `json:"-"`
AccessTime int64 `json:"access_time"`
CreationTime int64 `json:"creation_time"`
ModifyTime int64 `json:"modify_time"`
Size int64 `json:"size"`
Name string `json:"name"`
ParentPath string `json:"parent_path"`
Files []FileEntry `json:"files"`
}
type HarbingerArguments ¶
type HarbingerArguments struct {
Sleep *int `json:"sleep,omitempty"`
Jitter *int `json:"jitter,omitempty"`
File string `json:"file,omitempty"`
Remotename string `json:"remotename,omitempty"`
Path string `json:"path,omitempty"`
Host string `json:"host,omitempty"`
Arguments string `json:"arguments_str,omitempty"`
Safe bool `json:"safe,omitempty"`
Source string `json:"source,omitempty"`
Dest string `json:"dest,omitempty"`
Port int `json:"port,omitempty"`
Action string `json:"action,omitempty"`
Command string `json:"command,omitempty"`
Folder string `json:"folder,omitempty"`
Destination string `json:"destination,omitempty"`
Filename string `json:"filename,omitempty"`
Cmdline string `json:"cmdline,omitempty"`
Hwbp bool `json:"hwbp,omitempty"`
}
type Worker ¶
type Worker struct {
HarbingerClient messagesv1.HarbingerClient // Client to the main Harbinger gRPC service
C2ServerID string // Unique ID for this C2 server instance
Hostname string // Hostname where this worker is running (optional, but useful)
Settings *messagesv1.SettingsResponse // Settings fetched from Harbinger for this C2
C2 C2Bridge // The specific C2 implementation (e.g., MythicBridge)
// contains filtered or unexported fields
}
Worker represents the generic base worker for a C2 integration.
type WorkflowActivities ¶
type WorkflowActivities interface {
SyncAll(ctx context.Context) error
RunJob(ctx context.Context, job RunJob) (C2Task, error)
WaitForTask(ctx context.Context, task C2Task) (WorkflowStepResult, error)
}
Workflow activities common to all C2 integrations. These methods will be directly called and registered by the base worker.