Help us shape the future of Go! Take the 2026 Go Developer Survey

plugin

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

Documentation

Index

Constants

View Source
const (
	LuaScript = "lua"
	GoPlugin  = "go"
)
View Source
const CMDSeq = ":"

Variables

View Source
var (
	ReservedARGS    = "args"
	ReservedCMDLINE = "cmdline"
	ReservedWords   = []string{ReservedCMDLINE, ReservedARGS}

	LuaPackages = map[string]*lua.LTable{}

	ProtoPackage  = []string{"implantpb", "clientpb", "modulepb"}
	GlobalPlugins []*DefaultPlugin
)
View Source
var (
	MalType = "lua"
)

Functions

func GenerateLuaDefinitionFile

func GenerateLuaDefinitionFile(L *lua.LState, filename string) error

func GenerateMarkdownDefinitionFile added in v0.0.3

func GenerateMarkdownDefinitionFile(L *lua.LState, pkg, filename string) error

func LoadLib added in v0.0.3

func LoadLib(vm *lua.LState)

func NewLuaVM

func NewLuaVM() *lua.LState

func NewYaegiInterpreter added in v0.0.3

func NewYaegiInterpreter() *interp.Interpreter

func RegisterAllProtobufMessages

func RegisterAllProtobufMessages(L *lua.LState)

RegisterAllProtobufMessages 注册 implantpb 和 clientpb 中的所有 Protobuf Message

func RegisterProtobufMessage

func RegisterProtobufMessage(L *lua.LState, msgType string, msg proto.Message)

RegisterProtobufMessage 注册 Protobuf message 类型到 Lua

func RegisterProtobufMessageType

func RegisterProtobufMessageType(L *lua.LState)

// 注册 Protobuf Message 的类型和方法

func RegisterProtobufMessagesFromPackage

func RegisterProtobufMessagesFromPackage(L *lua.LState, pkg string)

RegisterProtobufMessagesFromPackage 注册指定包中所有的 Protobuf Message

Types

type Command added in v0.0.3

type Command struct {
	Name    string
	Long    string
	Example string
	CMD     *cobra.Command
	Subs    Commands
	Parent  *Command
}

type Commands added in v0.0.3

type Commands map[string]*Command

func (Commands) Find added in v0.0.3

func (cs Commands) Find(name string) *Command

func (Commands) SetCommand added in v0.0.3

func (cs Commands) SetCommand(name string, cmd *cobra.Command)

type DefaultPlugin added in v0.0.3

type DefaultPlugin struct {
	*MalManiFest
	Enable  bool
	Content []byte
	Path    string
	CMDs    Commands
	Events  map[intermediate.EventCondition]intermediate.OnEventFunc
}

func LoadGlobalLuaPlugin added in v0.0.3

func LoadGlobalLuaPlugin() []*DefaultPlugin

func NewPlugin

func NewPlugin(manifest *MalManiFest) (*DefaultPlugin, error)

func (*DefaultPlugin) Commands added in v0.0.3

func (plug *DefaultPlugin) Commands() Commands

func (*DefaultPlugin) GetEvents added in v0.0.3

func (*DefaultPlugin) Manifest added in v0.0.3

func (plug *DefaultPlugin) Manifest() *MalManiFest

type GoMalPlugin added in v0.0.3

type GoMalPlugin struct {
	*DefaultPlugin
	Interpreter *interp.Interpreter
}

func NewGoMalPlugin added in v0.0.3

func NewGoMalPlugin(manifest *MalManiFest) (*GoMalPlugin, error)

func (*GoMalPlugin) Run added in v0.0.3

func (plug *GoMalPlugin) Run() error

type LuaPlugin added in v0.0.3

type LuaPlugin struct {
	*DefaultPlugin
	// contains filtered or unexported fields
}

func NewLuaMalPlugin added in v0.0.3

func NewLuaMalPlugin(manifest *MalManiFest) (*LuaPlugin, error)

func (*LuaPlugin) RegisterLuaBuiltin added in v0.0.3

func (plug *LuaPlugin) RegisterLuaBuiltin() error

func (*LuaPlugin) Run added in v0.0.3

func (plug *LuaPlugin) Run() error

type MalManiFest

type MalManiFest struct {
	Name         string   `json:"name" yaml:"name"`
	Type         string   `json:"type" yaml:"type"` // lua, tcl
	Author       string   `json:"author" yaml:"author"`
	Version      string   `json:"version" yaml:"version"`
	EntryFile    string   `json:"entry" yaml:"entry"`
	Lib          bool     `json:"lib" yaml:"lib"`
	DependModule []string `json:"depend_module" yaml:"depend_modules"`
	DependArmory []string `json:"depend_armory" yaml:"depend_armory"`
}

func GetPluginManifest added in v0.0.3

func GetPluginManifest() []*MalManiFest

func LoadMalManiFest added in v0.0.3

func LoadMalManiFest(filename string) (*MalManiFest, error)

func ParseMalManifest added in v0.0.3

func ParseMalManifest(data []byte) (*MalManiFest, error)

type Plugin

type Plugin interface {
	Run() error
	Manifest() *MalManiFest
	Commands() Commands
	GetEvents() map[intermediate.EventCondition]intermediate.OnEventFunc
}

Jump to

Keyboard shortcuts

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