Documentation
¶
Overview ¶
Package plugin 加载插件、执行插件、获取插件信息,支持JSON/YAML和Go插件
Index ¶
- Constants
- Variables
- func GetPlugins() (plugins []map[string]interface{})
- func InitCelEnv(c *CustomLib) (*cel.Env, error)
- func Regist(target string, plugin GoPlugin)
- func Scan(task Task) (result []map[string]interface{})
- type Checker
- type CustomLib
- type GoPlugin
- type JSONPlugin
- type ListItem
- type ListMap
- type Plugin
- type PocDetail
- type References
- type Rule
- type RuleMap
- type RuleMapSlice
- type RuleRequest
- type Task
- type TaskMeta
- type TmpRule
- type YAMLPlugin
Constants ¶
View Source
const ( ONLY_AND = "only and in expr" ONLY_OR = "only or in expr" )
Variables ¶
View Source
var DeclMap = decls.NewMapType(decls.String, decls.String)
View Source
var GoPlugins map[string][]GoPlugin
GoPlugins GO插件集
View Source
var JSONPlugins map[string][]JSONPlugin
JSONPlugins JSON插件集
View Source
var LevelMap = map[string]int{
"critical": 0,
"high": 1,
"medium": 2,
"low": 3,
"warn": 4,
}
View Source
var YAMLPlugins map[string][]YAMLPlugin
YAMLPlugins YAML插件集
Functions ¶
Types ¶
type CustomLib ¶
type CustomLib struct {
EnvOptions []cel.EnvOption
ProgramOptionList []cel.ProgramOption
}
var Custom CustomLib
func (*CustomLib) CompileOptions ¶
func (*CustomLib) ProgramOptions ¶
func (c *CustomLib) ProgramOptions() []cel.ProgramOption
type GoPlugin ¶
type GoPlugin interface {
Init() Plugin
Check(netloc string, meta TaskMeta) bool
GetResult() []Plugin
}
GoPlugin 插件接口
type JSONPlugin ¶
type JSONPlugin struct {
Target string `json:"target"` // 插件对应资产类型
Meta Plugin `json:"meta,omitempty"`
Request struct {
Path string `json:"path"`
PostData string `json:"postdata,omitempty"`
Headers map[string]string `json:"headers,omitempty"`
} `json:"request"`
Verify struct {
Type string `json:"type"`
Match string `json:"match"`
} `json:"verify"`
Extra bool
}
JSONPlugin JSON插件
type Plugin ¶
type Plugin struct {
PluginType string `json:"plugintype,omitempty"` //插件类型
Name string `json:"name"`
Remarks string `json:"remarks"`
Level int `json:"level"` //0:严重 1:高危 2:中危 3:低危 4:提示
Type string `json:"type"` //漏洞类型
Author string `json:"author"`
References References `json:"references"`
Target string `json:"target,omitempty"`
// json plugin
Request string `json:"request,omitempty"`
Response string `json:"response,omitempty"`
// yaml plugin
Set string `json:"set,omitempty"`
Sets string `json:"sets,omitempty"`
Rules string `json:"rules,omitempty"`
Expression string `json:"expression,omitempty"`
Reviewer string `bson:"reviewer" json:"reviewer"`
ReviewStatus uint `bson:"reviewstatus" json:"reviewstatus"` //1:未审核 2: 审核中 3: 已审核
ReviewOpinion string `bson:"reviewopinion" json:"reviewopinion"`
ApplyTime time.Time `bson:"applytime" json:"applytime"`
ReviewTime time.Time `bson:"reviewtime" json:"reviewtime"`
UpdateTime time.Time `bson:"updatetime" json:"updatetime"`
}
Plugin 漏洞插件信息
type PocDetail ¶
type PocDetail struct {
Author string `yaml:"author"`
Reference []string `yaml:"reference,omitempty"`
Severity string `yaml:"severity"` //critical:严重 high:高危 medium:中危 low:低危 warn: 提示
Description string `yaml:"description"`
VulType string `yaml:"vultype"`
KPID string `yaml:"kpid"`
CVE string `yaml:"cve,omitempty"`
Reviewer string `yaml:"reviewer"`
ReviewStatus uint `yaml:"reviewstatus"`
ReviewOpinion string `yaml:"reviewopinion"`
ApplyTime time.Time `yaml:"applytime"`
ReviewTime time.Time `yaml:"reviewtime"`
UpdateTime time.Time `yaml:"updatetime"`
}
type References ¶
type References struct {
URL string `json:"url,omitempty"` //参考链接
CVE string `json:"cve,omitempty"`
KPID string `json:"kpid"`
}
References 插件附加信息
type Rule ¶
type Rule struct {
Request RuleRequest `yaml:"request"`
Expression string `yaml:"expression"`
Output yaml.MapSlice `yaml:"output,omitempty"`
// contains filtered or unexported fields
}
func (*Rule) UnmarshalYAML ¶
type RuleMapSlice ¶
type RuleMapSlice []RuleMap
func (RuleMapSlice) MarshalYAML ¶
func (m RuleMapSlice) MarshalYAML() (interface{}, error)
func (*RuleMapSlice) UnmarshalYAML ¶
func (m *RuleMapSlice) UnmarshalYAML(unmarshal func(interface{}) error) error
type RuleRequest ¶
type RuleRequest struct {
Method string `yaml:"method,omitempty"`
Path string `yaml:"path,omitempty"`
Body string `yaml:"body,omitempty"`
FollowRedirects bool `yaml:"follow_redirects,omitempty"`
Headers map[string]string `yaml:"headers,omitempty"`
// 以下字段用于tcp类漏洞验证
Type string `yaml:"type,omitempty"`
Host string `yaml:"host,omitempty"`
Data string `yaml:"data,omitempty"`
DataType string `yaml:"data-type,omitempty"`
}
type Task ¶
type Task struct {
Type string `json:"type"`
Netloc string `json:"netloc"`
Target string `json:"target"` //扫描插件ID
Meta TaskMeta `json:"meta"`
}
Task 任务结构
type TaskMeta ¶
type TaskMeta struct {
System string `json:"system"`
PathList []string `json:"pathlist"`
FileList []string `json:"filelist"`
PassList []string `json:"passlist"`
AppUser string `json:"appuser"`
WeakPassInterval int `json:"weakpassinterval"`
}
TaskMeta 任务额外信息
type TmpRule ¶
type TmpRule struct {
Request RuleRequest `yaml:"request"`
Expression string `yaml:"expression"`
Output yaml.MapSlice `yaml:"output"`
}
type YAMLPlugin ¶
Click to show internal directories.
Click to hide internal directories.