fuzzTypes

package
v0.2.0-7 Latest Latest
Warning

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

Go to latest
Published: Nov 23, 2025 License: MIT Imports: 7 Imported by: 2

Documentation

Index

Constants

View Source
const (
	ReactOutput = 1 << iota
	ReactAddJob
	ReactStopJob
	ReactFiltered
	ReactMatch
	ReactAddReq
	ReactMerge

	InfiniteLoop = -1

	DefaultFuzzKeyword = "MILAOGIU"
)

Variables

This section is empty.

Functions

func Plugin2Expr added in v0.2.0

func Plugin2Expr(p Plugin) string

Plugin2Expr 单个plugin转为字符串表达式

func Plugins2Expr

func Plugins2Expr(plugins []Plugin) string

Plugins2Expr 将plugin切片转为字符串表达式

Types

type Field added in v0.2.0

type Field struct {
	Name  string `json:"name" xml:"name"`   // 字段名
	Value string `json:"value" xml:"value"` // 字段值
}

Field 描述一个请求字段

type Fuzz

type Fuzz struct {
	// 预处理阶段的设置
	Preprocess FuzzStagePreprocess `json:"preprocess,omitempty"`
	// 请求阶段的设置
	Request FuzzStageRequest `json:"request,omitempty"`
	// 响应阶段的设置
	React FuzzStageReact `json:"react,omitempty"`
	// 任务控制设置
	Control FuzzControl `json:"control,omitempty"`
}

Fuzz 测试任务结构,包含执行单个fuzz任务所需的所有信息

func (*Fuzz) Clone added in v0.2.0

func (f *Fuzz) Clone() *Fuzz

Clone 将当前的Fuzz结构克隆一份,但是不克隆payload列表

type FuzzControl added in v0.2.0

type FuzzControl struct {
	PoolSize   int           `json:"pool_size,omitempty"`   // 使用的协程池大小
	Delay      time.Duration `json:"delay,omitempty"`       // 每次提交任务前的延迟
	OutSetting OutputSetting `json:"out_setting,omitempty"` // 输出设置
	IterCtrl   Iteration     `json:"iter_ctrl,omitempty"`   // 迭代控制
}

FuzzControl fuzz任务控制信息

type FuzzStagePreprocess added in v0.2.0

type FuzzStagePreprocess struct {
	PlMeta        map[string]*PayloadMeta `json:"pl_meta,omitempty"`       // 任务使用的fuzz关键字与对应的payload信息
	Preprocessors []Plugin                `json:"preprocessors,omitempty"` // 使用的自定义预处理器
	ReqTemplate   Req                     `json:"request_tmpl,omitempty"`  // 含有fuzz关键字的请求模板
}

FuzzStagePreprocess fuzz任务预处理阶段的相关信息

type FuzzStageReact added in v0.2.0

type FuzzStageReact struct {
	Reactor          Plugin                `json:"reactor,omitempty"`           // 响应处理插件
	Filter           Match                 `json:"filter,omitempty"`            // 过滤
	Matcher          Match                 `json:"matcher,omitempty"`           // 匹配
	IgnoreError      bool                  `json:"ignore_error,omitempty"`      // 是否忽略发送过程中出现的错误
	RecursionControl ReactRecursionControl `json:"recursion_control,omitempty"` // 递归控制
}

FuzzStageReact fuzz任务响应阶段相关信息

type FuzzStageRequest added in v0.2.0

type FuzzStageRequest struct {
	Proxies             []string `json:"proxies,omitempty"`               // 使用的代理
	HttpFollowRedirects bool     `json:"http_follow_redirects,omitempty"` // 是否重定向
	Retry               int      `json:"retry,omitempty"`                 // 错误重试次数
	RetryCode           string   `json:"retry_code,omitempty"`            // 返回特定状态码时重试
	RetryRegex          string   `json:"retry_regex,omitempty"`           // 返回匹配正则时重试
	Timeout             int      `json:"timeout,omitempty"`               // 超时时间
}

FuzzStageRequest fuzz任务请求阶段使用的信息

type HTTPSpec

type HTTPSpec struct {
	Method      string   `json:"method,omitempty" xml:"method,omitempty"`
	Headers     []string `json:"headers,omitempty" xml:"headers>header,omitempty"`
	Proto       string   `json:"proto,omitempty" xml:"proto,omitempty"`
	ForceHttps  bool     `json:"force_https,omitempty" xml:"force_https,omitempty"`
	RandomAgent bool     `json:"http_random_agent,omitempty"`
}

type Iteration added in v0.2.0

type Iteration struct {
	Start    int    `json:"start"`    // 迭代起始下标
	End      int    `json:"end"`      // 迭代终止下标
	Iterator Plugin `json:"iterator"` // 迭代器
}

Iteration 迭代设置

type Match

type Match struct {
	Code  []Range `json:"code,omitempty"`
	Lines []Range `json:"lines,omitempty"`
	Words []Range `json:"words,omitempty"`
	Size  []Range `json:"size,omitempty"`
	Regex string  `json:"regex,omitempty"`
	Mode  string  `json:"mode,omitempty"`
	Time  struct {
		Lower time.Duration `json:"lower,omitempty"`
		Upper time.Duration `json:"upper,omitempty"`
	} `json:"time,omitempty"`
}

func (Match) LiteralClone added in v0.2.0

func (m Match) LiteralClone() Match

LiteralClone 克隆Match结构的字面值(会新建Range切片)

type OutputSetting added in v0.2.0

type OutputSetting struct {
	Verbosity    int    `json:"verbosity,omitempty"`     // 输出详细程度
	OutputFile   string `json:"output_file,omitempty"`   // 输出文件名
	OutputFormat string `json:"output_format,omitempty"` // 文件输出格式
	HttpURL      string `json:"http_url,omitempty"`      // 将结果POST到http url上
	ChanSize     int    `json:"chan_size,omitempty"`     // 使用管道输出时,管道的大小
	ToWhere      int32  `json:"to_where,omitempty"`      // 输出到什么地方(文件、屏幕、管道)
}

OutputSetting 输出相关设置

type PayloadMeta added in v0.2.0

type PayloadMeta struct {
	Generators PlGen    `json:"generators,omitempty"`
	Processors []Plugin `json:"processors,omitempty"`
	PlList     []string `json:"pl_list,omitempty"`
}

PayloadMeta 与单个关键字相关联的payload相关设置

type PayloadTemp

type PayloadTemp struct {
	Generators PlGen    `json:"generators,omitempty"`
	Processors []Plugin `json:"processors,omitempty"`
	PlList     []string `json:"pl_list,omitempty"`
}

PayloadTemp 与单个关键字相关联的payload相关设置 deprecated

type PlGen

type PlGen struct {
	Type string   `json:"type"`
	Gen  []Plugin `json:"gen"`
}

type Plugin

type Plugin struct {
	Name string `json:"name,omitempty"`
	Args []any  `json:"args,omitempty"`
}

Plugin 标记插件名和参数

func (Plugin) MarshalJSON added in v0.2.0

func (p Plugin) MarshalJSON() ([]byte, error)

MarshalJSON 自定义Plugin类序列化函数

func (*Plugin) UnmarshalJSON added in v0.2.0

func (p *Plugin) UnmarshalJSON(data []byte) error

type Range

type Range struct {
	Upper int `json:"upper,omitempty"`
	Lower int `json:"lower,omitempty"`
}

Range 表示一个范围中的全部整数,上下界都是闭合的

type ReactRecursionControl added in v0.2.0

type ReactRecursionControl struct {
	RecursionDepth    int     `json:"recursion_depth,omitempty"`     // 当前递归深度
	MaxRecursionDepth int     `json:"max_recursion_depth,omitempty"` // 最大递归深度
	Keyword           string  `json:"keyword,omitempty"`             // 递归模板关键字
	StatCodes         []Range `json:"stat_codes,omitempty"`          // 匹配的状态码
	Regex             string  `json:"regex,omitempty"`               // 匹配正则
	Splitter          string  `json:"splitter,omitempty"`            // 分隔payload与递归关键字的分隔符
}

ReactRecursionControl fuzz任务响应阶段的递归控制信息

type Reaction

type Reaction struct {
	Flag   uint32 `json:"flag,omitempty"` // 响应标志
	Output struct {
		Msg       string `json:"msg,omitempty"`       // 输出信息
		Overwrite bool   `json:"overwrite,omitempty"` // 输出信息是否覆盖默认输出信息
	} `json:"output,omitempty"`
	NewJob *Fuzz `json:"new_job,omitempty"` // 如果要添加新任务,新任务结构体指针
	NewReq *Req  `json:"new_req,omitempty"` // 如果要添加新请求,新请求结构体指针
}

Reaction 响应

type Req

type Req struct {
	URL      string   `json:"url,omitempty" xml:"url,omitempty"`             // 请求url
	HttpSpec HTTPSpec `json:"http_spec,omitempty" xml:"http_spec,omitempty"` // http相关的设置与字段
	Fields   []Field  `json:"fields,omitempty" xml:"fields,omitempty"`       // 请求中的额外字段
	Data     []byte   `json:"data,omitempty" xml:"data,omitempty"`           // 数据载体
}

Req 请求对象

func (*Req) Clone added in v0.2.0

func (req *Req) Clone() *Req

Clone 克隆Req结构,返回新结构的指针

func (*Req) LiteralClone added in v0.2.0

func (req *Req) LiteralClone() Req

LiteralClone 克隆Req结构的字面值(重新分配切片)

type RequestCtx added in v0.2.0

type RequestCtx struct {
	Request             *Req   `json:"request,omitempty"`               // 发送的请求
	Proxy               string `json:"proxy,omitempty"`                 // 使用的代理
	Retry               int    `json:"retry,omitempty"`                 // 错误重试次数
	RetryCode           string `json:"retry_code,omitempty"`            // 返回特定状态码时重试
	RetryRegex          string `json:"retry_regex,omitempty"`           // 返回匹配正则时重试
	Timeout             int    `json:"timeout,omitempty"`               // 超时
	HttpFollowRedirects bool   `json:"http_follow_redirects,omitempty"` // http重定向
}

RequestCtx 包括了请求本身以及与请求相关的设置(超时、代理等)的结构

func (*RequestCtx) Clone added in v0.2.0

func (rc *RequestCtx) Clone() *RequestCtx

Clone 克隆RequestCtx结构

type Resp

type Resp struct {
	HttpResponse      *http.Response `json:"-" xml:"-"` // http响应包(但是tag标记为空,因为不能反序列化)
	ResponseTime      time.Duration  `json:"response_time,omitempty" xml:"response_time,omitempty"`
	Size              int            `json:"size,omitempty" xml:"size,omitempty"`
	Words             int            `json:"words,omitempty" xml:"words,omitempty"`
	Lines             int            `json:"lines,omitempty" xml:"lines,omitempty"`
	HttpRedirectChain string         `json:"http_redirect_chain,omitempty" xml:"http_redirect_chain,omitempty"`
	RawResponse       []byte         `json:"raw_response,omitempty" xml:"raw_response,omitempty"`
	ErrMsg            string         `json:"err_msg,omitempty" xml:"err_msg,omitempty"`
}

Resp 响应对象

func (*Resp) Statistic added in v0.2.0

func (resp *Resp) Statistic()

Statistic 根据rawResponse计算返回包的统计数据(词数、返回包大小、行数)

Jump to

Keyboard shortcuts

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