plugin

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Apr 13, 2025 License: Apache-2.0 Imports: 26 Imported by: 0

Documentation

Index

Constants

View Source
const (
	LuaInternal = iota
	LuaFlag
	LuaArg
	LuaReverse
)
View Source
const (
	LuaScript = "lua"
	GoPlugin  = "go"
)
View Source
const CMDSeq = ":"

Variables

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

	ProtoPackage  = []string{"implantpb", "clientpb", "modulepb"}
	GlobalPlugins []*DefaultPlugin
)

Functions

func NewLuaVM

func NewLuaVM() *lua.LState

func NewYaegiInterpreter added in v0.0.3

func NewYaegiInterpreter() *interp.Interpreter

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 LuaParam added in v0.1.0

type LuaParam struct {
	Name string
	Type int
}

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) Acquire added in v0.1.0

func (plug *LuaPlugin) Acquire() (*LuaVMWrapper, error)

func (*LuaPlugin) RegisterLuaBuiltin added in v0.0.3

func (plug *LuaPlugin) RegisterLuaBuiltin(vm *lua.LState) error

func (*LuaPlugin) Release added in v0.1.0

func (plug *LuaPlugin) Release(wrapper *LuaVMWrapper)

func (*LuaPlugin) Run added in v0.0.3

func (plug *LuaPlugin) Run() error

type LuaVMPool added in v0.1.0

type LuaVMPool struct {
	// contains filtered or unexported fields
}

func NewLuaVMPool added in v0.1.0

func NewLuaVMPool(maxSize int, initScript string, plugName string) (*LuaVMPool, error)

func (*LuaVMPool) AcquireVM added in v0.1.0

func (p *LuaVMPool) AcquireVM() (*LuaVMWrapper, error)

func (*LuaVMPool) ReleaseVM added in v0.1.0

func (p *LuaVMPool) ReleaseVM(wrapper *LuaVMWrapper)

type LuaVMWrapper added in v0.1.0

type LuaVMWrapper struct {
	*lua.LState
	// contains filtered or unexported fields
}

func NewLuaVMWrapper added in v0.1.0

func NewLuaVMWrapper() *LuaVMWrapper

func (*LuaVMWrapper) Lock added in v0.1.0

func (w *LuaVMWrapper) Lock()

func (*LuaVMWrapper) Unlock added in v0.1.0

func (w *LuaVMWrapper) Unlock()

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