fuzzTypes

package
v0.2.0-4 Latest Latest
Warning

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

Go to latest
Published: Oct 27, 2025 License: MIT Imports: 6 Imported by: 2

Documentation

Index

Constants

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

	InfiniteLoop = -1
)

Reaction使用的flag

Variables

This section is empty.

Functions

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 struct {
		PlTemp        map[string]PayloadTemp `json:"pl_temp,omitempty"`
		Preprocessors []Plugin               `json:"preprocessors,omitempty"` // 使用的自定义预处理器
		ReqTemplate   Req                    `json:"request_tmpl,omitempty"`  // 含有fuzz关键字的请求模板
	} `json:"preprocess,omitempty"`
	// 请求阶段的设置
	Request 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"`               // 超时时间
	} `json:"request,omitempty"`
	// 响应阶段的设置
	React struct {
		Reactor          Plugin `json:"reactor,omitempty"`      // 响应处理插件
		Filter           Match  `json:"filter,omitempty"`       // 过滤
		Matcher          Match  `json:"matcher,omitempty"`      // 匹配
		IgnoreError      bool   `json:"ignore_error,omitempty"` // 是否忽略发送过程中出现的错误
		RecursionControl 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"`
		} `json:"recursion_control,omitempty"`
	} `json:"react,omitempty"`
	// 任务控制设置
	Control 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"`   // 迭代控制
	} `json:"control,omitempty"`
}

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

type HTTPSpec

type HTTPSpec struct {
	Method      string   `json:"method,omitempty" xml:"method,omitempty"`
	Headers     []string `json:"headers,omitempty" xml:"header>headers,omitempty"`
	Version     string   `json:"version,omitempty" xml:"version,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"`
}

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 PayloadTemp

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

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

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 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 请求对象

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 包括了请求本身以及与请求相关的设置(超时、代理等)的结构

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 响应对象

Jump to

Keyboard shortcuts

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