c2

package
v0.1.9 Latest Latest
Warning

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

Go to latest
Published: Jan 10, 2020 License: AGPL-3.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidLengthTransport        = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowTransport          = fmt.Errorf("proto: integer overflow")
	ErrUnexpectedEndOfGroupTransport = fmt.Errorf("proto: unexpected end of group")
)

Functions

This section is empty.

Types

type AgentMessage

type AgentMessage struct {
	Metadata *AgentMetadata `protobuf:"bytes,1,opt,name=metadata,proto3" json:"metadata,omitempty"`
	Results  []*TaskResult  `protobuf:"bytes,2,rep,name=results,proto3" json:"results,omitempty"`
	Logs     []string       `protobuf:"bytes,3,rep,name=logs,proto3" json:"logs,omitempty"`
}

func NewPopulatedAgentMessage

func NewPopulatedAgentMessage(r randyTransport, easy bool) *AgentMessage

func (*AgentMessage) Descriptor

func (*AgentMessage) Descriptor() ([]byte, []int)

func (*AgentMessage) Equal

func (this *AgentMessage) Equal(that interface{}) bool

func (*AgentMessage) GetLogs

func (m *AgentMessage) GetLogs() []string

func (*AgentMessage) GetMetadata

func (m *AgentMessage) GetMetadata() *AgentMetadata

func (*AgentMessage) GetResults

func (m *AgentMessage) GetResults() []*TaskResult

func (*AgentMessage) GoString

func (this *AgentMessage) GoString() string

func (*AgentMessage) Marshal

func (m *AgentMessage) Marshal() (dAtA []byte, err error)

func (*AgentMessage) MarshalTo

func (m *AgentMessage) MarshalTo(dAtA []byte) (int, error)

func (*AgentMessage) MarshalToSizedBuffer

func (m *AgentMessage) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*AgentMessage) ProtoMessage

func (*AgentMessage) ProtoMessage()

func (*AgentMessage) Reset

func (m *AgentMessage) Reset()

func (*AgentMessage) Size

func (m *AgentMessage) Size() (n int)

func (*AgentMessage) String

func (this *AgentMessage) String() string

func (*AgentMessage) Unmarshal

func (m *AgentMessage) Unmarshal(dAtA []byte) error

func (*AgentMessage) XXX_DiscardUnknown

func (m *AgentMessage) XXX_DiscardUnknown()

func (*AgentMessage) XXX_Marshal

func (m *AgentMessage) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*AgentMessage) XXX_Merge

func (m *AgentMessage) XXX_Merge(src proto.Message)

func (*AgentMessage) XXX_Size

func (m *AgentMessage) XXX_Size() int

func (*AgentMessage) XXX_Unmarshal

func (m *AgentMessage) XXX_Unmarshal(b []byte) error

type AgentMetadata

type AgentMetadata struct {
	AgentID     string `protobuf:"bytes,1,opt,name=agentID,proto3" json:"agentID,omitempty"`
	MachineUUID string `protobuf:"bytes,2,opt,name=machineUUID,proto3" json:"machineUUID,omitempty"`
	SessionID   string `protobuf:"bytes,3,opt,name=sessionID,proto3" json:"sessionID,omitempty"`
	Hostname    string `protobuf:"bytes,4,opt,name=hostname,proto3" json:"hostname,omitempty"`
	PrimaryIP   string `protobuf:"bytes,5,opt,name=primaryIP,proto3" json:"primaryIP,omitempty"`
	PrimaryMAC  string `protobuf:"bytes,6,opt,name=primaryMAC,proto3" json:"primaryMAC,omitempty"`
}

func NewPopulatedAgentMetadata

func NewPopulatedAgentMetadata(r randyTransport, easy bool) *AgentMetadata

func (*AgentMetadata) Descriptor

func (*AgentMetadata) Descriptor() ([]byte, []int)

func (*AgentMetadata) Equal

func (this *AgentMetadata) Equal(that interface{}) bool

func (*AgentMetadata) GetAgentID

func (m *AgentMetadata) GetAgentID() string

func (*AgentMetadata) GetHostname

func (m *AgentMetadata) GetHostname() string

func (*AgentMetadata) GetMachineUUID

func (m *AgentMetadata) GetMachineUUID() string

func (*AgentMetadata) GetPrimaryIP

func (m *AgentMetadata) GetPrimaryIP() string

func (*AgentMetadata) GetPrimaryMAC

func (m *AgentMetadata) GetPrimaryMAC() string

func (*AgentMetadata) GetSessionID

func (m *AgentMetadata) GetSessionID() string

func (*AgentMetadata) GoString

func (this *AgentMetadata) GoString() string

func (*AgentMetadata) Marshal

func (m *AgentMetadata) Marshal() (dAtA []byte, err error)

func (*AgentMetadata) MarshalTo

func (m *AgentMetadata) MarshalTo(dAtA []byte) (int, error)

func (*AgentMetadata) MarshalToSizedBuffer

func (m *AgentMetadata) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*AgentMetadata) ProtoMessage

func (*AgentMetadata) ProtoMessage()

func (*AgentMetadata) Reset

func (m *AgentMetadata) Reset()

func (*AgentMetadata) Size

func (m *AgentMetadata) Size() (n int)

func (*AgentMetadata) String

func (this *AgentMetadata) String() string

func (*AgentMetadata) Unmarshal

func (m *AgentMetadata) Unmarshal(dAtA []byte) error

func (*AgentMetadata) XXX_DiscardUnknown

func (m *AgentMetadata) XXX_DiscardUnknown()

func (*AgentMetadata) XXX_Marshal

func (m *AgentMetadata) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*AgentMetadata) XXX_Merge

func (m *AgentMetadata) XXX_Merge(src proto.Message)

func (*AgentMetadata) XXX_Size

func (m *AgentMetadata) XXX_Size() int

func (*AgentMetadata) XXX_Unmarshal

func (m *AgentMetadata) XXX_Unmarshal(b []byte) error

type Server

type Server struct {
	Teamserver
}

Server manages communication with agents. Upon check-in, the server will claim and respond with any tasks available for the agent.

func (Server) HandleAgent

func (srv Server) HandleAgent(ctx context.Context, msg AgentMessage) (*ServerMessage, error)

HandleAgent is a transport-agnostic method for handling agent communications.

func (Server) HandleJSON

func (srv Server) HandleJSON(ctx context.Context, src io.Reader, dst io.Writer) error

HandleJSON provides wraps HandleAgent by decoding a JSON AgentMessage from src and encoding a JSON ServerMessage to dst.

func (Server) ServeHTTP

func (srv Server) ServeHTTP(w http.ResponseWriter, req *http.Request)

ServeHTTP wraps HandleJSON to provide a server handler for HTTP(s) transport.

func (*Server) ServeStatus

func (srv *Server) ServeStatus(w http.ResponseWriter, req *http.Request)

ServeStatus is an HTTP handler that returns the C2 Server status

type ServerMessage

type ServerMessage struct {
	Tasks []*Task `protobuf:"bytes,1,rep,name=tasks,proto3" json:"tasks,omitempty"`
}

func NewPopulatedServerMessage

func NewPopulatedServerMessage(r randyTransport, easy bool) *ServerMessage

func (*ServerMessage) Descriptor

func (*ServerMessage) Descriptor() ([]byte, []int)

func (*ServerMessage) Equal

func (this *ServerMessage) Equal(that interface{}) bool

func (*ServerMessage) GetTasks

func (m *ServerMessage) GetTasks() []*Task

func (*ServerMessage) GoString

func (this *ServerMessage) GoString() string

func (*ServerMessage) Marshal

func (m *ServerMessage) Marshal() (dAtA []byte, err error)

func (*ServerMessage) MarshalTo

func (m *ServerMessage) MarshalTo(dAtA []byte) (int, error)

func (*ServerMessage) MarshalToSizedBuffer

func (m *ServerMessage) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*ServerMessage) ProtoMessage

func (*ServerMessage) ProtoMessage()

func (*ServerMessage) Reset

func (m *ServerMessage) Reset()

func (*ServerMessage) Size

func (m *ServerMessage) Size() (n int)

func (*ServerMessage) String

func (this *ServerMessage) String() string

func (*ServerMessage) Unmarshal

func (m *ServerMessage) Unmarshal(dAtA []byte) error

func (*ServerMessage) XXX_DiscardUnknown

func (m *ServerMessage) XXX_DiscardUnknown()

func (*ServerMessage) XXX_Marshal

func (m *ServerMessage) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*ServerMessage) XXX_Merge

func (m *ServerMessage) XXX_Merge(src proto.Message)

func (*ServerMessage) XXX_Size

func (m *ServerMessage) XXX_Size() int

func (*ServerMessage) XXX_Unmarshal

func (m *ServerMessage) XXX_Unmarshal(b []byte) error

type Task

type Task struct {
	Id      int64  `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`
	Content string `protobuf:"bytes,2,opt,name=content,proto3" json:"content,omitempty"`
}

func NewPopulatedTask

func NewPopulatedTask(r randyTransport, easy bool) *Task

func (*Task) Descriptor

func (*Task) Descriptor() ([]byte, []int)

func (*Task) Equal

func (this *Task) Equal(that interface{}) bool

func (*Task) GetContent

func (m *Task) GetContent() string

func (*Task) GetId

func (m *Task) GetId() int64

func (*Task) GoString

func (this *Task) GoString() string

func (*Task) Marshal

func (m *Task) Marshal() (dAtA []byte, err error)

func (*Task) MarshalTo

func (m *Task) MarshalTo(dAtA []byte) (int, error)

func (*Task) MarshalToSizedBuffer

func (m *Task) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*Task) ProtoMessage

func (*Task) ProtoMessage()

func (*Task) Reset

func (m *Task) Reset()

func (*Task) Size

func (m *Task) Size() (n int)

func (*Task) String

func (this *Task) String() string

func (*Task) Unmarshal

func (m *Task) Unmarshal(dAtA []byte) error

func (*Task) XXX_DiscardUnknown

func (m *Task) XXX_DiscardUnknown()

func (*Task) XXX_Marshal

func (m *Task) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Task) XXX_Merge

func (m *Task) XXX_Merge(src proto.Message)

func (*Task) XXX_Size

func (m *Task) XXX_Size() int

func (*Task) XXX_Unmarshal

func (m *Task) XXX_Unmarshal(b []byte) error

type TaskResult

type TaskResult struct {
	Id            int64            `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`
	Output        string           `protobuf:"bytes,2,opt,name=output,proto3" json:"output,omitempty"`
	Error         string           `protobuf:"bytes,3,opt,name=error,proto3" json:"error,omitempty"`
	ExecStartTime *types.Timestamp `protobuf:"bytes,4,opt,name=execStartTime,proto3" json:"execStartTime,omitempty"`
	ExecStopTime  *types.Timestamp `protobuf:"bytes,5,opt,name=execStopTime,proto3" json:"execStopTime,omitempty"`
}

func NewPopulatedTaskResult

func NewPopulatedTaskResult(r randyTransport, easy bool) *TaskResult

func (*TaskResult) CloseWithError

func (m *TaskResult) CloseWithError(err error)

CloseWithError marks the end of task execution, and provides any error the task resulted in.

func (*TaskResult) Descriptor

func (*TaskResult) Descriptor() ([]byte, []int)

func (*TaskResult) Equal

func (this *TaskResult) Equal(that interface{}) bool

func (*TaskResult) GetError

func (m *TaskResult) GetError() string

func (*TaskResult) GetExecStartTime

func (m *TaskResult) GetExecStartTime() *types.Timestamp

func (*TaskResult) GetExecStopTime

func (m *TaskResult) GetExecStopTime() *types.Timestamp

func (*TaskResult) GetId

func (m *TaskResult) GetId() int64

func (*TaskResult) GetOutput

func (m *TaskResult) GetOutput() string

func (*TaskResult) GoString

func (this *TaskResult) GoString() string

func (*TaskResult) Marshal

func (m *TaskResult) Marshal() (dAtA []byte, err error)

func (*TaskResult) MarshalTo

func (m *TaskResult) MarshalTo(dAtA []byte) (int, error)

func (*TaskResult) MarshalToSizedBuffer

func (m *TaskResult) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*TaskResult) ProtoMessage

func (*TaskResult) ProtoMessage()

func (*TaskResult) Reset

func (m *TaskResult) Reset()

func (*TaskResult) Size

func (m *TaskResult) Size() (n int)

func (*TaskResult) Start

func (m *TaskResult) Start()

Start recording results for task execution.

func (*TaskResult) String

func (this *TaskResult) String() string

func (*TaskResult) Unmarshal

func (m *TaskResult) Unmarshal(dAtA []byte) error

func (*TaskResult) XXX_DiscardUnknown

func (m *TaskResult) XXX_DiscardUnknown()

func (*TaskResult) XXX_Marshal

func (m *TaskResult) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*TaskResult) XXX_Merge

func (m *TaskResult) XXX_Merge(src proto.Message)

func (*TaskResult) XXX_Size

func (m *TaskResult) XXX_Size() int

func (*TaskResult) XXX_Unmarshal

func (m *TaskResult) XXX_Unmarshal(b []byte) error

type Teamserver

type Teamserver interface {
	ClaimTasks(context.Context, models.ClaimTasksRequest) ([]*ent.Task, error)
	SubmitTaskResult(context.Context, models.SubmitTaskResultRequest) error
}

Teamserver provides client methods used to interact with a teamserver.

Directories

Path Synopsis
Package mocks is a generated GoMock package.
Package mocks is a generated GoMock package.

Jump to

Keyboard shortcuts

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