Documentation
¶
Index ¶
- Constants
- Variables
- func BindYakitPluginContextToEngine(nIns *antlr4yak.Engine, pluginContext *YakitPluginContext)
- func CallYakitPluginFunc(scriptName string, hookName string) (interface{}, error)
- func ClearHelper(helper *yakdoc.DocumentHelper)
- func DocumentHelperWithVerboseInfo(funcMap map[string]interface{}) *yakdoc.DocumentHelper
- func EngineToDocumentHelperWithVerboseInfo(engine *antlr4yak.Engine) *yakdoc.DocumentHelper
- func EngineToLibDocuments(engine *antlr4yak.Engine) []yakdocument.LibDoc
- func Execute(code string, params ...map[string]any) (*antlr4yak.Engine, error)
- func FeedbackFactory(db *gorm.DB, caller func(result *ypb.ExecResult) error, saveToDb bool, ...) func(i interface{}, items ...interface{})
- func FetchFunctionFromSourceCode(y *YakToCallerManager, pluginContext *YakitPluginContext, id string, ...) (map[string]*YakFunctionCaller, error)
- func Fuzz_WithHotPatch(ctx context.Context, code string) mutate.FuzzConfigOpt
- func GetDeprecatedFunctionDecls(helper *yakdoc.DocumentHelper) []*yakdoc.DeprecateFunction
- func GetInterfaceDocumentFromAST(pkg *ast.Package, interfaceName string) map[string]string
- func GetMethodFuncDeclFromAST(pkg *ast.Package, libName, structName, methodName, yakFuncName string, ...) *yakdoc.FuncDecl
- func HookCliArgs(nIns *antlr4yak.Engine, tempArgs []string) *cli.CliApp
- func ImportVarFromFile(file string, exportsName string) (interface{}, error)
- func ImportVarFromScript(engine *antlr4yak.Engine, script string, exportsName string) (interface{}, error)
- func ImportVarFromYakFile(path string, exportsName string) (interface{}, error)
- func InitYaklangLib()
- func IsSameTypeName(typName1, typName2 string) bool
- func LoadingVariableFrom(path string, exportsName string, opts ...yakEvalConfigOpt) ([]*yakVariable, error)
- func MutateHookCaller(raw string, caller YakitCallerIf) (func(https bool, originReq []byte, req []byte) []byte, ...)
- func MutateWithParamsGetter(raw string) func() *mutate.RegexpMutateCondition
- func MutateWithYaklang(raw string) *mutate.RegexpMutateCondition
- func QuickEvalWithoutContext(i interface{}) error
- func SetNaslExports(lib map[string]interface{})
- func StaticAnalyzeYaklang(code string, typs ...string) []*result.StaticAnalyzeResult
- type Caller
- type CallerHookDescription
- type CallerHooks
- type EmbedFieldTypeAndMethod
- type InstanceMethodHandler
- type LibFuncWithFrameType
- type MixPluginCaller
- func (m *MixPluginCaller) CallHijackRequest(isHttps bool, u string, getRequest func() interface{}, ...)
- func (m *MixPluginCaller) CallHijackResponse(isHttps bool, u string, getResponse, reject, drop func() interface{})
- func (m *MixPluginCaller) CallHijackResponseEx(isHttps bool, u string, ...)
- func (c *MixPluginCaller) FeedbackOrdinary(i interface{})
- func (m *MixPluginCaller) GetNativeCaller() *YakToCallerManager
- func (m *MixPluginCaller) HandleServiceScanResult(r *fp.MatchResult)
- func (m *MixPluginCaller) HijackSaveHTTPFlow(flow *schema.HTTPFlow, reject func(httpFlow *schema.HTTPFlow), drop func())
- func (c *MixPluginCaller) IsPassed(target string) bool
- func (c *MixPluginCaller) LoadHotPatch(ctx context.Context, code string) error
- func (m *MixPluginCaller) LoadPlugin(scriptName string, params ...*ypb.ExecParamItem) error
- func (m *MixPluginCaller) LoadPluginByName(ctx context.Context, name string, params []*ypb.ExecParamItem, codes ...string) error
- func (m *MixPluginCaller) LoadPluginEx(ctx context.Context, script *schema.YakScript, params ...*ypb.ExecParamItem) error
- func (m *MixPluginCaller) MirrorHTTPFlow(isHttps bool, u string, req, rsp, body []byte, filters ...bool)
- func (m *MixPluginCaller) MirrorHTTPFlowEx(scanPort bool, isHttps bool, u string, req, rsp, body []byte, filters ...bool)
- func (m *MixPluginCaller) MirrorHTTPFlowExSync(scanPort bool, isHttps bool, u string, req, rsp, body []byte, filters ...bool)
- func (c *MixPluginCaller) ResetFilter()
- func (m *MixPluginCaller) SetCache(b bool)
- func (c *MixPluginCaller) SetCallPluginTimeout(i float64)
- func (c *MixPluginCaller) SetConcurrent(i int) error
- func (m *MixPluginCaller) SetCtx(ctx context.Context)
- func (m *MixPluginCaller) SetDividedContext(b bool)
- func (m *MixPluginCaller) SetFeedback(i func(i *ypb.ExecResult) error)
- func (c *MixPluginCaller) SetLoadPluginTimeout(i float64)
- func (m *MixPluginCaller) SetProxy(s string)
- func (m *MixPluginCaller) SetRuntimeId(s string)
- func (c *MixPluginCaller) Wait()
- type PalmScriptEngineHelper
- type PalmScriptLib
- type PalmScriptLibFunc
- type PalmScriptLibInstance
- type Sandbox
- type SandboxConfig
- type SandboxOption
- type ScriptEngine
- func (e *ScriptEngine) Compile(code string) ([]byte, error)
- func (e *ScriptEngine) Execute(code string) error
- func (e *ScriptEngine) ExecuteEx(code string, params map[string]interface{}) (*antlr4yak.Engine, error)
- func (e *ScriptEngine) ExecuteExWithContext(ctx context.Context, code string, params map[string]interface{}) (_ *antlr4yak.Engine, fErr error)
- func (e *ScriptEngine) ExecuteMain(code string, AbsFile string) error
- func (e *ScriptEngine) ExecuteMainWithContext(ctx context.Context, code string, AbsFile string) error
- func (e *ScriptEngine) ExecuteWithContext(ctx context.Context, code string) error
- func (e *ScriptEngine) ExecuteWithTaskID(taskId, code string) error
- func (e *ScriptEngine) ExecuteWithTaskIDAndContext(ctx context.Context, taskId, code string) error
- func (e *ScriptEngine) ExecuteWithTaskIDAndParams(ctx context.Context, taskId, code string, params map[string]interface{}) error
- func (e *ScriptEngine) ExecuteWithTemplate(codeTmp string, i map[string][]string) error
- func (e *ScriptEngine) ExecuteWithoutCache(code string, params map[string]interface{}) (*antlr4yak.Engine, error)
- func (s *ScriptEngine) GetTaskByTaskID(id string) (*Task, error)
- func (e *ScriptEngine) HookOsExit()
- func (e *ScriptEngine) RegisterEngineHooks(f func(engine *antlr4yak.Engine) error)
- func (s *ScriptEngine) SaveTask(task *Task) error
- func (s *ScriptEngine) SetCryptoKey(key []byte) error
- func (s *ScriptEngine) SetDebug(debug bool)
- func (s *ScriptEngine) SetDebugCallback(callback func(*yakvm.Debugger))
- func (s *ScriptEngine) SetDebugInit(callback func(*yakvm.Debugger))
- func (e *ScriptEngine) SetYakitClient(client *yaklib.YakitClient)
- func (s *ScriptEngine) Status() map[string]*Task
- type Task
- type TextHandlingScript
- type TextParser
- type YakFunctionCaller
- type YakToCallerManager
- func (y *YakToCallerManager) Add(ctx context.Context, id string, paramMap map[string]any, code string, ...) (retError error)
- func (y *YakToCallerManager) AddForYakit(ctx context.Context, id string, paramMap map[string]any, code string, ...) error
- func (y *YakToCallerManager) AddGoNative(id string, name string, cb func(...interface{}))
- func (y *YakToCallerManager) CallByName(name string, items ...interface{})
- func (y *YakToCallerManager) CallByNameEx(name string, items ...func() interface{})
- func (y *YakToCallerManager) CallByNameExSync(name string, items ...func() interface{})
- func (y *YakToCallerManager) CallByNameSync(name string, items ...interface{})
- func (y *YakToCallerManager) CallPluginKeyByName(pluginId string, name string, items ...interface{})
- func (y *YakToCallerManager) CallPluginKeyByNameEx(pluginId string, name string, itemsFuncs ...func() interface{})
- func (y *YakToCallerManager) CallPluginKeyByNameExWithAsync(forceSync bool, pluginId string, name string, itemsFuncs ...func() interface{})
- func (y *YakToCallerManager) CallPluginKeyByNameSync(pluginId string, name string, items ...interface{})
- func (y *YakToCallerManager) GetCurrentHooks() []*CallerHooks
- func (y *YakToCallerManager) GetCurrentHooksGRPCModel() []*ypb.YakScriptHooks
- func (y *YakToCallerManager) LoadPlugin(t string, hooks ...string) error
- func (y *YakToCallerManager) LoadPluginContext(ctx context.Context, t string, hooks ...string) error
- func (y *YakToCallerManager) Remove(params *ypb.RemoveHookParams)
- func (y *YakToCallerManager) Set(ctx context.Context, code string, hook func(engine *antlr4yak.Engine) error, ...) (retError error)
- func (c *YakToCallerManager) SetCallPluginTimeout(i float64)
- func (m *YakToCallerManager) SetConcurrent(i int) error
- func (y *YakToCallerManager) SetDividedContext(b bool)
- func (y *YakToCallerManager) SetForYakit(ctx context.Context, code string, callerIf interface{ ... }, hooks ...string) error
- func (c *YakToCallerManager) SetLoadPluginTimeout(i float64)
- func (y *YakToCallerManager) ShouldCallByName(name string) bool
- func (y *YakToCallerManager) SyncCallPluginKeyByNameEx(pluginId string, name string, itemsFuncs ...func() interface{})
- func (y *YakToCallerManager) Wait()
- func (y *YakToCallerManager) WithDefaultFilter(filter *filter.StringFilter) *YakToCallerManager
- type YakitCallerIf
- type YakitPluginContext
- func (y *YakitPluginContext) WithCliApp(cliApp *cli.CliApp) *YakitPluginContext
- func (y *YakitPluginContext) WithContext(ctx context.Context) *YakitPluginContext
- func (y *YakitPluginContext) WithContextCancel(cancel context.CancelFunc) *YakitPluginContext
- func (y *YakitPluginContext) WithDefaultFilter(filter *filter.StringFilter) *YakitPluginContext
- func (y *YakitPluginContext) WithPluginName(id string) *YakitPluginContext
- func (y *YakitPluginContext) WithProxy(proxy string) *YakitPluginContext
Constants ¶
View Source
const ( // func mirrorHTTPFlow(isHttps, url, request, response, body) // mirror hijacked by filtered http flows HOOK_MirrorFilteredHTTPFlow = "mirrorFilteredHTTPFlow" // func mirrorHTTPFlow(isHttps, url, request, response, body) // mirror hijacked all HOOK_MirrorHTTPFlow = "mirrorHTTPFlow" // func mirrorNewWebsite(isHttps, url, request, response, body) HOOK_MirrorNewWebsite = "mirrorNewWebsite" // schema + addr // func mirrorNewWebsitePath(isHttps, url, request, response, body) HOOK_MirrorNewWebsitePath = "mirrorNewWebsitePath" // schema + addr + path (remove params) // func mirrorNewWebsitePathParams(isHttps, url, request, response, body) HOOK_MirrorNewWebsitePathParams = "mirrorNewWebsitePathParams" // schema + addr + path + param_names // func hijackHTTPRequest(isHttps, url, request, forward/*func(modified []byte)*/, drop /*func()*/) HOOK_HijackHTTPRequest = "hijackHTTPRequest" // func hijackHTTPRequest(isHttps, url, response, forward/*func(modified []byte)*/, drop /*func()*/) HOOK_HijackHTTPResponse = "hijackHTTPResponse" // func hijackHTTPRequest(isHttps, url, request, response, forward/*func(modified []byte)*/, drop /*func()*/) HOOK_HijackHTTPResponseEx = "hijackHTTPResponseEx" // func hijackSaveHTTPFlow(record *httpFlow, forward func(*httpFlow), drop func()) return (*httpFlow) HOOK_hijackSaveHTTPFlow = "hijackSaveHTTPFlow" // func handle(r *fp.MatchResult) HOOK_PortScanHandle = "handle" // func execNuclei(target) HOOK_NucleiScanHandle = "execNuclei" HOOK_NaslScanHandle = "execNasl" HOOK_LoadNaslScriptByNameFunc = "loadNaslScriptByNameFunc" )
View Source
const HOOK_CLAER = "clear"
Variables ¶
View Source
var (
CRYPTO_KEY_SIZE = 16
)
View Source
var EvalExports = map[string]interface{}{ "Eval": QuickEvalWithoutContext, "LoadVarFromFile": LoadingVariableFrom, "Import": ImportVarFromFile, "IsYakFunc": yaklang.IsYakFunction, "params": setYakEvalParams, "recursive": setYakBatchImportRecursiveParams, }
View Source
var GlobalEvalExports = map[string]interface{}{ "import": ImportVarFromFile, }
View Source
var HooksExports = map[string]interface{}{ "NewManager": NewYakToCallerManager, "NewMixPluginCaller": NewMixPluginCaller, "NewMixPluginCallerWithFilter": NewMixPluginCallerWithFilter, "RemoveYakitPluginByName": removeScriptByNameCtx, "LoadYakitPluginContext": loadScriptCtx, "LoadYakitPlugin": loadScript, "LoadYakitPluginByName": loadScriptByName, "CallYakitPluginFunc": CallYakitPluginFunc, }
View Source
var MITMAndPortScanHooks = []string{ HOOK_MirrorFilteredHTTPFlow, HOOK_MirrorHTTPFlow, HOOK_MirrorNewWebsite, HOOK_MirrorNewWebsitePath, HOOK_MirrorNewWebsitePathParams, HOOK_CLAER, HOOK_HijackHTTPRequest, HOOK_HijackHTTPResponse, HOOK_HijackHTTPResponseEx, HOOK_hijackSaveHTTPFlow, HOOK_PortScanHandle, }
View Source
var SandboxExports = map[string]any{ "Create": NewSandbox, "library": WithSandbox_ExternalLib, }
View Source
var YAK_TEMPLATE_NUCLEI_EXECUTOR string
Functions ¶
func BindYakitPluginContextToEngine ¶ added in v1.2.3
func BindYakitPluginContextToEngine(nIns *antlr4yak.Engine, pluginContext *YakitPluginContext)
func CallYakitPluginFunc ¶
func ClearHelper ¶ added in v1.2.9
func ClearHelper(helper *yakdoc.DocumentHelper)
func DocumentHelperWithVerboseInfo ¶ added in v1.3.1
func DocumentHelperWithVerboseInfo(funcMap map[string]interface{}) *yakdoc.DocumentHelper
func EngineToDocumentHelperWithVerboseInfo ¶
func EngineToDocumentHelperWithVerboseInfo(engine *antlr4yak.Engine) *yakdoc.DocumentHelper
func EngineToLibDocuments ¶
func EngineToLibDocuments(engine *antlr4yak.Engine) []yakdocument.LibDoc
! 老接口
func FeedbackFactory ¶
func FetchFunctionFromSourceCode ¶
func FetchFunctionFromSourceCode(y *YakToCallerManager, pluginContext *YakitPluginContext, id string, code string, hook func(e *antlr4yak.Engine) error, functionNames ...string) (map[string]*YakFunctionCaller, error)
func Fuzz_WithHotPatch ¶ added in v1.2.6
func Fuzz_WithHotPatch(ctx context.Context, code string) mutate.FuzzConfigOpt
func GetDeprecatedFunctionDecls ¶ added in v1.3.1
func GetDeprecatedFunctionDecls(helper *yakdoc.DocumentHelper) []*yakdoc.DeprecateFunction
func GetInterfaceDocumentFromAST ¶ added in v1.2.9
func GetMethodFuncDeclFromAST ¶ added in v1.2.9
func HookCliArgs ¶ added in v1.3.1
func ImportVarFromFile ¶
func ImportVarFromScript ¶
func ImportVarFromYakFile ¶
func InitYaklangLib ¶
func InitYaklangLib()
func IsSameTypeName ¶ added in v1.2.9
func LoadingVariableFrom ¶
func MutateHookCaller ¶
func MutateWithParamsGetter ¶
func MutateWithParamsGetter(raw string) func() *mutate.RegexpMutateCondition
func MutateWithYaklang ¶
func MutateWithYaklang(raw string) *mutate.RegexpMutateCondition
func QuickEvalWithoutContext ¶
func QuickEvalWithoutContext(i interface{}) error
func SetNaslExports ¶ added in v1.2.2
func SetNaslExports(lib map[string]interface{})
func StaticAnalyzeYaklang ¶ added in v1.3.1
func StaticAnalyzeYaklang(code string, typs ...string) []*result.StaticAnalyzeResult
Types ¶
type CallerHookDescription ¶
type CallerHooks ¶
type CallerHooks struct { HookName string Hooks []*CallerHookDescription }
type EmbedFieldTypeAndMethod ¶ added in v1.2.9
type InstanceMethodHandler ¶ added in v1.2.9
type InstanceMethodHandler struct {
// contains filtered or unexported fields
}
type LibFuncWithFrameType ¶
type MixPluginCaller ¶
type MixPluginCaller struct {
// contains filtered or unexported fields
}
func NewMixPluginCaller ¶
func NewMixPluginCaller() (*MixPluginCaller, error)
func NewMixPluginCallerWithFilter ¶ added in v1.3.1
func NewMixPluginCallerWithFilter(webFilter *filter.StringFilter) (*MixPluginCaller, error)
func (*MixPluginCaller) CallHijackRequest ¶
func (m *MixPluginCaller) CallHijackRequest( isHttps bool, u string, getRequest func() interface{}, reject func() interface{}, drop func() interface{}, )
func (*MixPluginCaller) CallHijackResponse ¶
func (m *MixPluginCaller) CallHijackResponse( isHttps bool, u string, getResponse, reject, drop func() interface{}, )
func (*MixPluginCaller) CallHijackResponseEx ¶
func (m *MixPluginCaller) CallHijackResponseEx( isHttps bool, u string, getRequest, getResponse, reject, drop func() interface{}, )
func (*MixPluginCaller) FeedbackOrdinary ¶
func (c *MixPluginCaller) FeedbackOrdinary(i interface{})
func (*MixPluginCaller) GetNativeCaller ¶
func (m *MixPluginCaller) GetNativeCaller() *YakToCallerManager
func (*MixPluginCaller) HandleServiceScanResult ¶
func (m *MixPluginCaller) HandleServiceScanResult(r *fp.MatchResult)
func (*MixPluginCaller) HijackSaveHTTPFlow ¶
func (m *MixPluginCaller) HijackSaveHTTPFlow(flow *schema.HTTPFlow, reject func(httpFlow *schema.HTTPFlow), drop func())
func (*MixPluginCaller) IsPassed ¶ added in v1.3.2
func (c *MixPluginCaller) IsPassed(target string) bool
func (*MixPluginCaller) LoadHotPatch ¶
func (c *MixPluginCaller) LoadHotPatch(ctx context.Context, code string) error
func (*MixPluginCaller) LoadPlugin ¶
func (m *MixPluginCaller) LoadPlugin(scriptName string, params ...*ypb.ExecParamItem) error
func (*MixPluginCaller) LoadPluginByName ¶
func (m *MixPluginCaller) LoadPluginByName(ctx context.Context, name string, params []*ypb.ExecParamItem, codes ...string) error
LoadPluginByName 基于脚本名加载插件,如果没有指定代码,则从数据库中加载,如果指定了代码,则默认视为mitm插件执行
func (*MixPluginCaller) LoadPluginEx ¶ added in v1.3.2
func (m *MixPluginCaller) LoadPluginEx(ctx context.Context, script *schema.YakScript, params ...*ypb.ExecParamItem) error
func (*MixPluginCaller) MirrorHTTPFlow ¶
func (m *MixPluginCaller) MirrorHTTPFlow( isHttps bool, u string, req, rsp, body []byte, filters ...bool, )
func (*MixPluginCaller) MirrorHTTPFlowEx ¶
func (*MixPluginCaller) MirrorHTTPFlowExSync ¶ added in v1.3.2
func (*MixPluginCaller) ResetFilter ¶
func (c *MixPluginCaller) ResetFilter()
func (*MixPluginCaller) SetCache ¶ added in v1.2.2
func (m *MixPluginCaller) SetCache(b bool)
func (*MixPluginCaller) SetCallPluginTimeout ¶ added in v1.3.2
func (c *MixPluginCaller) SetCallPluginTimeout(i float64)
func (*MixPluginCaller) SetConcurrent ¶
func (c *MixPluginCaller) SetConcurrent(i int) error
func (*MixPluginCaller) SetCtx ¶ added in v1.3.2
func (m *MixPluginCaller) SetCtx(ctx context.Context)
func (*MixPluginCaller) SetDividedContext ¶
func (m *MixPluginCaller) SetDividedContext(b bool)
func (*MixPluginCaller) SetFeedback ¶
func (m *MixPluginCaller) SetFeedback(i func(i *ypb.ExecResult) error)
func (*MixPluginCaller) SetLoadPluginTimeout ¶
func (c *MixPluginCaller) SetLoadPluginTimeout(i float64)
func (*MixPluginCaller) SetProxy ¶ added in v1.2.4
func (m *MixPluginCaller) SetProxy(s string)
func (*MixPluginCaller) SetRuntimeId ¶ added in v1.2.3
func (m *MixPluginCaller) SetRuntimeId(s string)
func (*MixPluginCaller) Wait ¶
func (c *MixPluginCaller) Wait()
type PalmScriptEngineHelper ¶
type PalmScriptEngineHelper struct { Libs map[string]*PalmScriptLib BuildInFunctions map[string]*PalmScriptLibFunc UserFunctions map[string]*PalmScriptLibFunc Instances map[string]*PalmScriptLibInstance }
func EngineToHelper ¶
func EngineToHelper(engine *antlr4yak.Engine) *PalmScriptEngineHelper
func (*PalmScriptEngineHelper) GetAllLibs ¶
func (p *PalmScriptEngineHelper) GetAllLibs() []string
func (*PalmScriptEngineHelper) HelpInfo ¶
func (p *PalmScriptEngineHelper) HelpInfo() string
func (*PalmScriptEngineHelper) LibHelpInfo ¶
func (p *PalmScriptEngineHelper) LibHelpInfo(name string) string
func (*PalmScriptEngineHelper) ShowHelpInfo ¶
func (p *PalmScriptEngineHelper) ShowHelpInfo()
func (*PalmScriptEngineHelper) ShowLibHelpInfo ¶
func (p *PalmScriptEngineHelper) ShowLibHelpInfo(name string)
type PalmScriptLib ¶
type PalmScriptLib struct { Name string Values map[string]interface{} ElementDocs []string FuncElements []*PalmScriptLibFunc InstanceElements []*PalmScriptLibInstance }
func (*PalmScriptLib) String ¶
func (p *PalmScriptLib) String() string
type PalmScriptLibFunc ¶
func (*PalmScriptLibFunc) String ¶
func (p *PalmScriptLibFunc) String() string
type PalmScriptLibInstance ¶
type PalmScriptLibInstance struct { LibName string InstanceName string Type string Value interface{} }
func (*PalmScriptLibInstance) String ¶
func (p *PalmScriptLibInstance) String() string
type Sandbox ¶ added in v1.3.1
type Sandbox struct {
// contains filtered or unexported fields
}
func NewSandbox ¶ added in v1.3.1
func NewSandbox(opts ...SandboxOption) *Sandbox
func (*Sandbox) ExecuteAsBoolean ¶ added in v1.3.1
func (*Sandbox) ExecuteAsExpression ¶ added in v1.3.1
type SandboxConfig ¶ added in v1.3.1
type SandboxConfig struct {
// contains filtered or unexported fields
}
type SandboxOption ¶ added in v1.3.1
type SandboxOption func(*SandboxConfig)
func WithSandbox_ExternalLib ¶ added in v1.3.1
func WithSandbox_ExternalLib(lib map[string]any) SandboxOption
type ScriptEngine ¶
type ScriptEngine struct { // 设定几个 hook RegisterLogHook yaklib.RegisterOutputFuncType UnregisterLogHook yaklib.UnregisterOutputFuncType RegisterLogConsoleHook yaklib.RegisterOutputFuncType UnregisterLogConsoleHook yaklib.UnregisterOutputFuncType RegisterOutputHook yaklib.RegisterOutputFuncType UnregisterOutputHook yaklib.UnregisterOutputFuncType RegisterFailedHook yaklib.RegisterOutputFuncType UnregisterFailedHook yaklib.UnregisterOutputFuncType RegisterFinishHook yaklib.RegisterOutputFuncType UnregisterFinishHook yaklib.UnregisterOutputFuncType RegisterAlertHook yaklib.RegisterOutputFuncType UnregisterAlertHook yaklib.UnregisterOutputFuncType // contains filtered or unexported fields }
func NewScriptEngine ¶
func NewScriptEngine(maxConcurrent int) *ScriptEngine
func NewYakitVirtualClientScriptEngine ¶ added in v1.2.2
func NewYakitVirtualClientScriptEngine(client *yaklib.YakitClient) *ScriptEngine
func (*ScriptEngine) Execute ¶
func (e *ScriptEngine) Execute(code string) error
func (*ScriptEngine) ExecuteExWithContext ¶
func (*ScriptEngine) ExecuteMain ¶
func (e *ScriptEngine) ExecuteMain(code string, AbsFile string) error
func (*ScriptEngine) ExecuteMainWithContext ¶
func (*ScriptEngine) ExecuteWithContext ¶
func (e *ScriptEngine) ExecuteWithContext(ctx context.Context, code string) error
func (*ScriptEngine) ExecuteWithTaskID ¶
func (e *ScriptEngine) ExecuteWithTaskID(taskId, code string) error
func (*ScriptEngine) ExecuteWithTaskIDAndContext ¶
func (e *ScriptEngine) ExecuteWithTaskIDAndContext(ctx context.Context, taskId, code string) error
func (*ScriptEngine) ExecuteWithTaskIDAndParams ¶
func (*ScriptEngine) ExecuteWithTemplate ¶
func (e *ScriptEngine) ExecuteWithTemplate(codeTmp string, i map[string][]string) error
func (*ScriptEngine) ExecuteWithoutCache ¶
func (*ScriptEngine) GetTaskByTaskID ¶
func (s *ScriptEngine) GetTaskByTaskID(id string) (*Task, error)
func (*ScriptEngine) HookOsExit ¶
func (e *ScriptEngine) HookOsExit()
func (*ScriptEngine) RegisterEngineHooks ¶
func (e *ScriptEngine) RegisterEngineHooks(f func(engine *antlr4yak.Engine) error)
func (*ScriptEngine) SaveTask ¶
func (s *ScriptEngine) SaveTask(task *Task) error
func (*ScriptEngine) SetCryptoKey ¶
func (s *ScriptEngine) SetCryptoKey(key []byte) error
func (*ScriptEngine) SetDebug ¶
func (s *ScriptEngine) SetDebug(debug bool)
func (*ScriptEngine) SetDebugCallback ¶
func (s *ScriptEngine) SetDebugCallback(callback func(*yakvm.Debugger))
func (*ScriptEngine) SetDebugInit ¶
func (s *ScriptEngine) SetDebugInit(callback func(*yakvm.Debugger))
func (*ScriptEngine) SetYakitClient ¶ added in v1.2.2
func (e *ScriptEngine) SetYakitClient(client *yaklib.YakitClient)
func (*ScriptEngine) Status ¶
func (s *ScriptEngine) Status() map[string]*Task
type Task ¶
type Task struct { TaskID string Code string Output []string Log []string Alert []string Finished []string Failed []string // contains filtered or unexported fields }
func (*Task) IsFinished ¶
type TextHandlingScript ¶
type TextParser ¶
type TextParser struct { Scripts map[string]*TextHandlingScript // contains filtered or unexported fields }
type YakFunctionCaller ¶
type YakFunctionCaller struct {
Handler func(args ...interface{})
}
type YakToCallerManager ¶
type YakToCallerManager struct { ContextCancelFuncs *sync.Map // contains filtered or unexported fields }
func NewYakToCallerManager ¶
func NewYakToCallerManager() *YakToCallerManager
func (*YakToCallerManager) AddForYakit ¶
func (*YakToCallerManager) AddGoNative ¶
func (y *YakToCallerManager) AddGoNative(id string, name string, cb func(...interface{}))
func (*YakToCallerManager) CallByName ¶
func (y *YakToCallerManager) CallByName(name string, items ...interface{})
func (*YakToCallerManager) CallByNameEx ¶
func (y *YakToCallerManager) CallByNameEx(name string, items ...func() interface{})
func (*YakToCallerManager) CallByNameExSync ¶
func (y *YakToCallerManager) CallByNameExSync(name string, items ...func() interface{})
func (*YakToCallerManager) CallByNameSync ¶ added in v1.3.2
func (y *YakToCallerManager) CallByNameSync(name string, items ...interface{})
func (*YakToCallerManager) CallPluginKeyByName ¶
func (y *YakToCallerManager) CallPluginKeyByName(pluginId string, name string, items ...interface{})
func (*YakToCallerManager) CallPluginKeyByNameEx ¶
func (y *YakToCallerManager) CallPluginKeyByNameEx(pluginId string, name string, itemsFuncs ...func() interface{})
func (*YakToCallerManager) CallPluginKeyByNameExWithAsync ¶
func (y *YakToCallerManager) CallPluginKeyByNameExWithAsync(forceSync bool, pluginId string, name string, itemsFuncs ...func() interface{})
func (*YakToCallerManager) CallPluginKeyByNameSync ¶ added in v1.3.2
func (y *YakToCallerManager) CallPluginKeyByNameSync(pluginId string, name string, items ...interface{})
func (*YakToCallerManager) GetCurrentHooks ¶
func (y *YakToCallerManager) GetCurrentHooks() []*CallerHooks
func (*YakToCallerManager) GetCurrentHooksGRPCModel ¶
func (y *YakToCallerManager) GetCurrentHooksGRPCModel() []*ypb.YakScriptHooks
func (*YakToCallerManager) LoadPlugin ¶
func (y *YakToCallerManager) LoadPlugin(t string, hooks ...string) error
func (*YakToCallerManager) LoadPluginContext ¶
func (*YakToCallerManager) Remove ¶
func (y *YakToCallerManager) Remove(params *ypb.RemoveHookParams)
func (*YakToCallerManager) SetCallPluginTimeout ¶ added in v1.3.2
func (c *YakToCallerManager) SetCallPluginTimeout(i float64)
func (*YakToCallerManager) SetConcurrent ¶
func (m *YakToCallerManager) SetConcurrent(i int) error
func (*YakToCallerManager) SetDividedContext ¶
func (y *YakToCallerManager) SetDividedContext(b bool)
func (*YakToCallerManager) SetForYakit ¶
func (y *YakToCallerManager) SetForYakit( ctx context.Context, code string, callerIf interface { Send(result *ypb.ExecResult) error }, hooks ...string, ) error
func (*YakToCallerManager) SetLoadPluginTimeout ¶
func (c *YakToCallerManager) SetLoadPluginTimeout(i float64)
func (*YakToCallerManager) ShouldCallByName ¶ added in v1.2.6
func (y *YakToCallerManager) ShouldCallByName(name string) bool
func (*YakToCallerManager) SyncCallPluginKeyByNameEx ¶
func (y *YakToCallerManager) SyncCallPluginKeyByNameEx(pluginId string, name string, itemsFuncs ...func() interface{})
func (*YakToCallerManager) Wait ¶
func (y *YakToCallerManager) Wait()
func (*YakToCallerManager) WithDefaultFilter ¶ added in v1.3.2
func (y *YakToCallerManager) WithDefaultFilter(filter *filter.StringFilter) *YakToCallerManager
type YakitCallerIf ¶
type YakitCallerIf func(result *ypb.ExecResult) error
func (YakitCallerIf) Send ¶
func (y YakitCallerIf) Send(i *ypb.ExecResult) error
type YakitPluginContext ¶ added in v1.2.4
type YakitPluginContext struct { PluginName string RuntimeId string Proxy string Ctx context.Context CliApp *cli.CliApp Cancel context.CancelFunc // contains filtered or unexported fields }
func CreateYakitPluginContext ¶ added in v1.3.1
func CreateYakitPluginContext(runtimeId string) *YakitPluginContext
func (*YakitPluginContext) WithCliApp ¶ added in v1.3.1
func (y *YakitPluginContext) WithCliApp(cliApp *cli.CliApp) *YakitPluginContext
func (*YakitPluginContext) WithContext ¶ added in v1.3.1
func (y *YakitPluginContext) WithContext(ctx context.Context) *YakitPluginContext
func (*YakitPluginContext) WithContextCancel ¶ added in v1.3.2
func (y *YakitPluginContext) WithContextCancel(cancel context.CancelFunc) *YakitPluginContext
func (*YakitPluginContext) WithDefaultFilter ¶ added in v1.3.1
func (y *YakitPluginContext) WithDefaultFilter(filter *filter.StringFilter) *YakitPluginContext
func (*YakitPluginContext) WithPluginName ¶ added in v1.3.1
func (y *YakitPluginContext) WithPluginName(id string) *YakitPluginContext
func (*YakitPluginContext) WithProxy ¶ added in v1.3.1
func (y *YakitPluginContext) WithProxy(proxy string) *YakitPluginContext
Source Files
¶
Click to show internal directories.
Click to hide internal directories.