rpc

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: 39 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Transport contextKey = iota
	Operator
)

Variables

View Source
var (
	// ErrInvalidSessionID - Invalid Session ID in request
	ErrInvalidSessionID = status.Error(codes.InvalidArgument, "Invalid session ID")

	// ErrMissingRequestField - Returned when a request does not contain a  implantpb.Request
	ErrMissingRequestField = status.Error(codes.InvalidArgument, "Missing session request field")
	// ErrAsyncNotSupported - Unsupported mode / command type
	ErrAsyncNotSupported = status.Error(codes.Unavailable, "Async not supported for this command")
	// ErrDatabaseFailure - Generic database failure error (real error is logged)
	ErrDatabaseFailure = status.Error(codes.Internal, "Database operation failed")
	ErrNilStatus       = status.Error(codes.InvalidArgument, "Nil status or unknown error")
	ErrAssertFailure   = status.Error(codes.InvalidArgument, "Assert spite type failure")
	ErrNilResponseBody = status.Error(codes.InvalidArgument, "Must return spite body")
	// ErrInvalidName - Invalid name
	ErrInvalidName     = status.Error(codes.InvalidArgument, "Invalid session name, alphanumerics and _-. only")
	ErrNotFoundSession = status.Error(codes.NotFound, "Session ID not found")
	ErrNotFoundTask    = status.Error(codes.NotFound, "Task ID not found")

	ErrNotFoundListener    = status.Error(codes.NotFound, "Listener not found")
	ErrNotFoundPipeline    = status.Error(codes.NotFound, "Pipeline not found")
	ErrNotFoundClientName  = status.Error(codes.NotFound, "Client name not found")
	ErrNotFoundTaskContent = status.Error(codes.NotFound, "Task content not found")
)

Functions

func AssertRequestName

func AssertRequestName(req *implantpb.Request, expect types.MsgName) error

func AssertResponse

func AssertResponse(spite *implantpb.Spite, expect types.MsgName) error

func AssertStatus

func AssertStatus(spite *implantpb.Spite) error

func AssertStatusAndResponse

func AssertStatusAndResponse(spite *implantpb.Spite, expect types.MsgName) error

func InitLogs

func InitLogs(debug bool)

func StartClientListener

func StartClientListener(port uint16) (*grpc.Server, net.Listener, error)

StartClientListener - Start a mutual TLS listener

Types

type GenericRequest

type GenericRequest struct {
	proto.Message
	Task    *core.Task
	Session *core.Session
}

func (*GenericRequest) HandlerAsyncResponse

func (r *GenericRequest) HandlerAsyncResponse(ch chan *implantpb.Spite, typ types.MsgName, callbacks ...func(spite *implantpb.Spite))

func (*GenericRequest) NewSpite

func (r *GenericRequest) NewSpite(msg proto.Message) (*implantpb.Spite, error)

func (*GenericRequest) NewTask

func (r *GenericRequest) NewTask(total int) *core.Task

func (*GenericRequest) SetCallback

func (r *GenericRequest) SetCallback(callback func())

type Server

func NewServer

func NewServer() *Server

NewServer - Create new server instance

func (*Server) AddClient

func (rpc *Server) AddClient(ctx context.Context, req *rootpb.Operator) (*rootpb.Response, error)

func (*Server) AddListener

func (s *Server) AddListener(ctx context.Context, req *rootpb.Operator) (*rootpb.Response, error)

func (*Server) BasicSessionOP

func (rpc *Server) BasicSessionOP(ctx context.Context, req *clientpb.BasicUpdateSession) (*clientpb.Empty, error)

func (*Server) Broadcast

func (rpc *Server) Broadcast(ctx context.Context, req *clientpb.Event) (*clientpb.Empty, error)

func (*Server) Cat

func (rpc *Server) Cat(ctx context.Context, req *implantpb.Request) (*clientpb.Task, error)

func (*Server) Cd

func (rpc *Server) Cd(ctx context.Context, req *implantpb.Request) (*clientpb.Task, error)

func (*Server) Chmod

func (rpc *Server) Chmod(ctx context.Context, req *implantpb.Request) (*clientpb.Task, error)

func (*Server) Chown

func (rpc *Server) Chown(ctx context.Context, req *implantpb.ChownRequest) (*clientpb.Task, error)

func (*Server) Cp

func (rpc *Server) Cp(ctx context.Context, req *implantpb.Request) (*clientpb.Task, error)

func (*Server) Curl

func (rpc *Server) Curl(ctx context.Context, req *implantpb.CurlRequest) (*clientpb.Task, error)

func (*Server) Download

func (rpc *Server) Download(ctx context.Context, req *implantpb.DownloadRequest) (*clientpb.Task, error)

Download - Download a file from implant

func (*Server) Env

func (rpc *Server) Env(ctx context.Context, req *implantpb.Request) (*clientpb.Task, error)

func (*Server) Events

func (rpc *Server) Events(_ *clientpb.Empty, stream clientrpc.MaliceRPC_EventsServer) error

func (*Server) Execute

func (rpc *Server) Execute(ctx context.Context, req *implantpb.ExecRequest) (*clientpb.Task, error)

func (*Server) ExecuteAssembly

func (rpc *Server) ExecuteAssembly(ctx context.Context, req *implantpb.ExecuteBinary) (*clientpb.Task, error)

func (*Server) ExecuteBof

func (rpc *Server) ExecuteBof(ctx context.Context, req *implantpb.ExecuteBinary) (*clientpb.Task, error)

func (*Server) ExecuteDll

func (rpc *Server) ExecuteDll(ctx context.Context, req *implantpb.ExecuteBinary) (*clientpb.Task, error)

func (*Server) ExecuteExtension

func (rpc *Server) ExecuteExtension(ctx context.Context, req *implantpb.ExecuteExtension) (*clientpb.Task, error)

func (*Server) ExecutePE

func (rpc *Server) ExecutePE(ctx context.Context, req *implantpb.ExecuteBinary) (*clientpb.Task, error)

func (*Server) ExecutePowershell

func (rpc *Server) ExecutePowershell(ctx context.Context, req *implantpb.ExecuteBinary) (*clientpb.Task, error)

func (*Server) ExecuteShellcode

func (rpc *Server) ExecuteShellcode(ctx context.Context, req *implantpb.ExecuteBinary) (*clientpb.Task, error)

func (*Server) GetAlivedSessions

func (rpc *Server) GetAlivedSessions(ctx context.Context, _ *clientpb.Empty) (*clientpb.Sessions, error)

func (*Server) GetAllTaskContent

func (rpc *Server) GetAllTaskContent(ctx context.Context, req *clientpb.Task) ([]*implantpb.Spite, error)

func (*Server) GetBasic

func (rpc *Server) GetBasic(ctx context.Context, _ *clientpb.Empty) (*clientpb.Basic, error)

func (*Server) GetClients

func (rpc *Server) GetClients(ctx context.Context, req *clientpb.Empty) (*clientpb.Clients, error)

func (*Server) GetListeners

func (rpc *Server) GetListeners(ctx context.Context, req *clientpb.Empty) (*clientpb.Listeners, error)

func (*Server) GetSession

func (rpc *Server) GetSession(ctx context.Context, req *clientpb.SessionRequest) (*clientpb.Session, error)

func (*Server) GetSessions

func (rpc *Server) GetSessions(ctx context.Context, _ *clientpb.Empty) (*clientpb.Sessions, error)

func (*Server) GetTaskContent

func (rpc *Server) GetTaskContent(ctx context.Context, req *clientpb.Task) (*implantpb.Spite, error)

func (*Server) GetTaskDescs

func (rpc *Server) GetTaskDescs(ctx context.Context, req *clientpb.Session) (*clientpb.TaskDescs, error)

func (*Server) GetTasks

func (rpc *Server) GetTasks(ctx context.Context, session *clientpb.Session) (*clientpb.Tasks, error)

func (*Server) Info

func (rpc *Server) Info(ctx context.Context, req *implantpb.Request) (*clientpb.Task, error)

func (*Server) JobStream

func (rpc *Server) JobStream(stream listenerrpc.ListenerRPC_JobStreamServer) error

func (*Server) Kill

func (rpc *Server) Kill(ctx context.Context, req *implantpb.Request) (*clientpb.Task, error)

func (*Server) ListClients

func (rpc *Server) ListClients(ctx context.Context, req *rootpb.Operator) (*clientpb.Clients, error)

func (*Server) ListExtensions

func (rpc *Server) ListExtensions(ctx context.Context, req *implantpb.Request) (*clientpb.Task, error)

func (*Server) ListListeners

func (s *Server) ListListeners(ctx context.Context, req *rootpb.Operator) (*clientpb.Listeners, error)

func (*Server) ListModules

func (rpc *Server) ListModules(ctx context.Context, req *implantpb.Request) (*clientpb.Task, error)

func (*Server) ListPipelines

func (rpc *Server) ListPipelines(ctx context.Context, req *lispb.ListenerName) (*lispb.Pipelines, error)

func (*Server) ListWebsites

func (rpc *Server) ListWebsites(ctx context.Context, req *lispb.ListenerName) (*lispb.Websites, error)

func (*Server) LoadExtension

func (rpc *Server) LoadExtension(ctx context.Context, req *implantpb.LoadExtension) (*clientpb.Task, error)

func (*Server) LoadModule

func (rpc *Server) LoadModule(ctx context.Context, req *implantpb.LoadModule) (*clientpb.Task, error)

func (*Server) LoginClient

func (rpc *Server) LoginClient(ctx context.Context, req *clientpb.LoginReq) (*clientpb.LoginResp, error)

func (*Server) Ls

func (rpc *Server) Ls(ctx context.Context, req *implantpb.Request) (*clientpb.Task, error)

func (*Server) Mkdir

func (rpc *Server) Mkdir(ctx context.Context, req *implantpb.Request) (*clientpb.Task, error)

func (*Server) Mv

func (rpc *Server) Mv(ctx context.Context, req *implantpb.Request) (*clientpb.Task, error)

func (*Server) Netstat

func (rpc *Server) Netstat(ctx context.Context, req *implantpb.Request) (*clientpb.Task, error)

func (*Server) Ping

func (rpc *Server) Ping(ctx context.Context, req *implantpb.Ping) (*implantpb.Empty, error)

func (*Server) Ps

func (rpc *Server) Ps(ctx context.Context, req *implantpb.Request) (*clientpb.Task, error)

func (*Server) Pwd

func (rpc *Server) Pwd(ctx context.Context, req *implantpb.Request) (*clientpb.Task, error)

func (*Server) Register

func (rpc *Server) Register(ctx context.Context, req *lispb.RegisterSession) (*implantpb.Empty, error)

func (*Server) RegisterListener

func (rpc *Server) RegisterListener(ctx context.Context, req *lispb.RegisterListener) (*implantpb.Empty, error)

func (*Server) RegisterPipeline

func (rpc *Server) RegisterPipeline(ctx context.Context, req *lispb.Pipeline) (*implantpb.Empty, error)

func (*Server) RegisterWebsite

func (rpc *Server) RegisterWebsite(ctx context.Context, req *lispb.Website) (*implantpb.Empty, error)

func (*Server) RemoveClient

func (rpc *Server) RemoveClient(ctx context.Context, req *rootpb.Operator) (*rootpb.Response, error)

func (*Server) RemoveListener

func (s *Server) RemoveListener(ctx context.Context, req *rootpb.Operator) (*rootpb.Response, error)

func (*Server) Rm

func (rpc *Server) Rm(ctx context.Context, req *implantpb.Request) (*clientpb.Task, error)

func (*Server) Setenv

func (rpc *Server) Setenv(ctx context.Context, req *implantpb.Request) (*clientpb.Task, error)

func (*Server) SpiteStream

func (rpc *Server) SpiteStream(stream listenerrpc.ListenerRPC_SpiteStreamServer) error

func (*Server) StartTcpPipeline

func (rpc *Server) StartTcpPipeline(ctx context.Context, req *lispb.Pipeline) (*clientpb.Empty, error)

func (*Server) StartWebsite

func (rpc *Server) StartWebsite(ctx context.Context, req *lispb.Pipeline) (*clientpb.Empty, error)

func (*Server) StopTcpPipeline

func (rpc *Server) StopTcpPipeline(ctx context.Context, req *lispb.TCPPipeline) (*clientpb.Empty, error)

func (*Server) StopWebsite

func (rpc *Server) StopWebsite(ctx context.Context, req *lispb.Website) (*clientpb.Empty, error)

func (*Server) Sync

func (rpc *Server) Sync(ctx context.Context, req *clientpb.Sync) (*clientpb.SyncResp, error)

func (*Server) SysInfo

func (rpc *Server) SysInfo(ctx context.Context, req *implantpb.SysInfo) (*implantpb.Empty, error)

func (*Server) Unsetenv

func (rpc *Server) Unsetenv(ctx context.Context, req *implantpb.Request) (*clientpb.Task, error)

func (*Server) Upload

func (rpc *Server) Upload(ctx context.Context, req *implantpb.UploadRequest) (*clientpb.Task, error)

Upload - Upload a file from the remote file system

func (*Server) WaitTaskContent

func (rpc *Server) WaitTaskContent(ctx context.Context, req *clientpb.Task) (*implantpb.Spite, error)

func (*Server) Website

func (rpc *Server) Website(ctx context.Context, req *lispb.Website) (*lispb.Website, error)

Website - Get one website

func (*Server) WebsiteAddContent

func (rpc *Server) WebsiteAddContent(ctx context.Context, req *lispb.WebsiteAddContent) (*lispb.Website, error)

WebsiteAddContent - Add content to a website, the website is created if `name` does not exist

func (*Server) WebsiteRemove

func (rpc *Server) WebsiteRemove(ctx context.Context, req *lispb.Website) (*clientpb.Empty, error)

func (*Server) WebsiteRemoveContent

func (rpc *Server) WebsiteRemoveContent(ctx context.Context, req *lispb.WebsiteRemoveContent) (*lispb.Website, error)

WebsiteRemoveContent - Remove specific content from a website

func (*Server) WebsiteUpdateContent

func (rpc *Server) WebsiteUpdateContent(ctx context.Context, req *lispb.WebsiteAddContent) (*lispb.Website, error)

WebsiteUpdateContent - Update specific content from a website, currently you can only the update Content-type field

func (*Server) Websites

func (rpc *Server) Websites(ctx context.Context, _ *clientpb.Empty) (*lispb.Websites, error)

func (*Server) Whoami

func (rpc *Server) Whoami(ctx context.Context, req *implantpb.Request) (*clientpb.Task, error)

Jump to

Keyboard shortcuts

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