common

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Aug 21, 2024 License: Apache-2.0 Imports: 31 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EmptySpite  = "empty"
	StatusSpite = "status"
	AckSpite    = "ack"
)

Variables

View Source
var (
	DefaultGRPCAddr     = "127.0.0.1:5004"
	DefaultListenerAddr = "127.0.0.1:5001"
	TestSid             = []byte{1, 2, 3, 4}
)

Functions

func GetCertificateAuthority

func GetCertificateAuthority(caType string) (*x509.Certificate, *rsa.PrivateKey, error)

GetCertificateAuthority - Get the current CA certificate

func GetCertificateAuthorityPEM

func GetCertificateAuthorityPEM(caType string) ([]byte, []byte, error)

GetCertificateAuthorityPEM - Get PEM encoded CA cert/key

func GetTLSConfig

func GetTLSConfig(caCertificate string, certificate string, privateKey string) (*tls.Config, error)

GetTLSConfig - Get the TLS config for the operator server

func RpcOptions

func RpcOptions() []grpc.DialOption

Types

type Client

type Client struct {
	Client   clientrpc.MaliceRPCClient
	Implant  listenerrpc.ImplantRPCClient
	Listener listenerrpc.ListenerRPCClient
	Root     clientrpc.RootRPCClient
	// contains filtered or unexported fields
}

func NewClient

func NewClient(addr string, sid []byte) *Client

func (*Client) Call

func (c *Client) Call(rpcname string, msg proto.Message) (proto.Message, error)

func (*Client) Meta

func (c *Client) Meta() context.Context

func (*Client) Send

func (c *Client) Send()

func (*Client) WaitResponse

func (c *Client) WaitResponse(task *clientpb.Task) (*implantpb.Spite, error)

type Implant

type Implant struct {
	Addr string
	Sid  []byte

	Enc bool
	Tls bool
	// contains filtered or unexported fields
}

func NewImplant

func NewImplant(addr string, sid []byte) *Implant

func (*Implant) BuildCommonSpite

func (implant *Implant) BuildCommonSpite(t string, taskId uint32) *implantpb.Spite

func (*Implant) BuildTaskSpite

func (implant *Implant) BuildTaskSpite(msg proto.Message, taskid uint32) (*implantpb.Spite, error)

func (*Implant) Connect

func (implant *Implant) Connect() (net.Conn, error)

func (*Implant) Expect

func (implant *Implant) Expect(req *implantpb.Spite, m types.MsgName) (proto.Message, error)

func (*Implant) Handler

func (implant *Implant) Handler(msg *implantpb.Spites)

func (*Implant) HandlerSpite

func (implant *Implant) HandlerSpite(msg *implantpb.Spite) *implantpb.Spite

func (*Implant) MustConnect

func (implant *Implant) MustConnect() net.Conn

func (*Implant) Read

func (implant *Implant) Read(conn net.Conn) (proto.Message, error)

func (*Implant) ReadWithTimeout

func (implant *Implant) ReadWithTimeout(conn net.Conn) (proto.Message, error)

func (*Implant) Register

func (implant *Implant) Register()

func (*Implant) Request

func (implant *Implant) Request(req *implantpb.Spite) (proto.Message, error)

func (*Implant) Run

func (implant *Implant) Run()

func (*Implant) Write

func (implant *Implant) Write(conn net.Conn, msg *implantpb.Spites) error

request spites

func (*Implant) WriteEmpty

func (implant *Implant) WriteEmpty(conn net.Conn) error

func (*Implant) WriteSpite

func (implant *Implant) WriteSpite(conn net.Conn, msg *implantpb.Spite) error

func (*Implant) WriteWithTimeout

func (implant *Implant) WriteWithTimeout(conn net.Conn, msg proto.Message) error

Jump to

Keyboard shortcuts

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