model

package
v0.0.1-beta Latest Latest
Warning

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

Go to latest
Published: Nov 27, 2025 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package model ----------------------------- @author : EndlessShw @time : 2025/10/5 13:51 @Description : CVE 的对应实体类 -------------------------------------------

Package model ----------------------------- @author : EndlessShw @time : 2025/9/17 23:57 @Description : 一条 CommonWebAttack 结构体 -------------------------------------------

Package model ----------------------------- @author : EndlessShw @time : 2025/9/17 23:50 @Description : ThreatData 为 threat.Threat 的上层装饰类,存放每种攻击的规则以及相关的配置等 -------------------------------------------

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CVE

type CVE struct {
	Templates []*struct {
		ID   string `json:"id"`
		Info *struct {
			Name     string `json:"name"`
			Severity string `json:"severity"`
		}
		Requests []*struct {
			// Raw 和 Path 二选一,如果都有以 Path 为准,最终都会转化成 Url
			Raw  []string   `json:"raw"`
			Path []string   `json:"path"`
			Url  []*url.URL `json:"-"`
			// 如果有 MatchersCondition,那么内部的 Condition 就会被忽略
			MatchersCondition string `json:"matchers-condition"`
			Matchers          []*struct {
				// Type 指定匹配规则,dsl、regex、word、status 三选一
				// 其中 Regex 和 Word 需要指定作用范围(请求体对应 dsl.Env 的 RequestInfo)
				Type  string   `json:"type"`
				DSL   []string `json:"dsl"`
				Regex []string `json:"regex"`
				Word  string   `json:"word"`
				// regex 和 word 的作用范围,和 DSL 的 dsl.Env 中的 RequestInfo 对应。
				Part string `json:"part"`
				// status 指定匹配的响应码
				Status []uint8 `json:"status"`
				// 指定这个规则是 And 还是 Or
				Condition   string           `json:"condition"`
				RegPatterns []*regexp.Regexp `json:"-"`
				DSLPrograms []*vm.Program    `json:"-"`
			}
		} `json:"requests"`
	} `json:"templates"`
}

func (*CVE) Print

func (cve *CVE) Print()

Print 为 Debug 时用的打印函数

type CWA

type CWA struct {
	Filters []struct {
		Description string   `json:"description"`
		ID          int64    `json:"id"`
		Impact      int64    `json:"impact"`
		Rule        string   `json:"rule"`
		Tags        []string `json:"tags"`
		Pattern     *regexp.Regexp
	} `json:"filters"`
}

type ThreatData

type ThreatData struct {

	// Data 存放各种攻击的规则(单纯的字符串,也就是 raw)
	Data map[threat.Threat]string

	// Cwa 为 CommonWebAttack 所需要的结构体,其中的 Filters Struct Slice 存放所有的规则
	Cwa *CWA

	// Cve 为 CVE 所需要的结构体,其中的 Templates Struct Slice 存放所有的规则
	Cve *CVE

	// BadCrawler 每行存放的是针对域名的正则表达式
	BadCrawler []*regexp.Regexp

	// MaliciousCommand 每行存放的是针对恶意命令的正则表达式
	MaliciousCommand []*regexp.Regexp
}

Jump to

Keyboard shortcuts

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