hsuanfuzz

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Jun 2, 2021 License: Apache-2.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetToken

func GetToken(t Token, print bool) string

GetToken obtains the authorization key based on the input information.

Types

type Coverage

type Coverage struct {
	Levels []int
}

Coverage records the test coverage level of each path.

func (*Coverage) String

func (c *Coverage) String() string

type Criteria

type Criteria struct {
	Input  InputCriteria
	Output OutputCriteria
}

Criteria is used to verify the test coverage model.

type Dependency

type Dependency struct {
	Count int                        `yaml:"count"`
	Paths map[string]*DependencyInfo `yaml:"paths"`
	Posts map[string]*DependencyPost `yaml:"posts"`
}

Dependency is used to manually enter the dependency of the path.

type DependencyInfo

type DependencyInfo struct {
	Items []*DependencyItem `yaml:"items"`
}

DependencyInfo presents the dependency of the path.

type DependencyItem

type DependencyItem struct {
	Key    string            `yaml:"key"`
	Source *DependencySource `yaml:"source"`
}

DependencyItem presents the ID and source required by the current path.

type DependencyPost

type DependencyPost struct {
	Flows []*DependencyPostItem `yaml:"flows"`
}

DependencyPost is used to define test coverage level 7.

type DependencyPostItem

type DependencyPostItem struct {
	Method string `yaml:"method"`
	Path   string `yaml:"path"`
}

DependencyPostItem presents the required request method and path.

type DependencySource

type DependencySource struct {
	Path string `yaml:"path"`
	Key  string `yaml:"key"`
}

DependencySource presents the source path and the ID field of the response.

type HsuanFuzz

type HsuanFuzz struct {
	Token Token
	// contains filtered or unexported fields
}

HsuanFuzz is the main structure of fuzzer.

func New

func New(openapiPath string, dirPath string, remove bool, strictMode bool) (*HsuanFuzz, error)

New will create a new HsuanFuzz, which is also initialized.

func (*HsuanFuzz) Fuzz

func (x *HsuanFuzz) Fuzz(guided bool) error

Fuzz is equivalent to the execution of Fuzzer, continuously fuzzing.

func (*HsuanFuzz) SendRequest

func (x *HsuanFuzz) SendRequest(node *base.Node, decode bool) *ResponseInfo

SendRequest uses our grammar to send the request.

type InputCriteria

type InputCriteria struct {
	Types      map[string]int
	Parameters map[string]int
}

InputCriteria is used to verify the input of the test coverage model.

type OutputCriteria

type OutputCriteria struct {
	Types       map[string]int
	CodeClasses map[int]int
	Codes       map[int]int
	Properties  map[string]int
}

OutputCriteria is used to verify the output of the test coverage model.

type PathInfo

type PathInfo struct {
	Paths map[string]*PathInfoMethod `yaml:"paths"`
}

PathInfo is used to display request information more easily.

type PathInfoMethod

type PathInfoMethod struct {
	Method map[string][]*PathInfoParameter `yaml:"methods"`
}

PathInfoMethod presents methods of the path.

type PathInfoParameter

type PathInfoParameter struct {
	Name  string      `yaml:"name,omitempty"`
	In    string      `yaml:"in,omitempty"`
	Value interface{} `yaml:"value"`
}

PathInfoParameter presents parameters of the path.

type ResponseInfo

type ResponseInfo struct {
	Code int
	Type string
	Body string
	// contains filtered or unexported fields
}

ResponseInfo is used to carry request and response information.

type Token

type Token struct {
	URL         string      `yaml:"url"`
	Method      string      `yaml:"method"`
	Key         string      `yaml:"key"`
	Bearer      string      `yaml:"bearer"` // is empty when initial
	ContentType string      `yaml:"type"`
	Body        interface{} `yaml:"body"`
	Hardcode    bool        `yaml:"hardcode"`
	In          string      `yaml:"in"`
}

Token is used to manually enter service authorization information.

Jump to

Keyboard shortcuts

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