check

package
v1.0.4 Latest Latest
Warning

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

Go to latest
Published: Mar 28, 2024 License: BSD-3-Clause Imports: 29 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	BodyBufPool = sync.Pool{
		New: func() interface{} {
			return make([]byte, 1024)
		},
	}
	BodyPool = sync.Pool{
		New: func() interface{} {
			return make([]byte, 4096)
		},
	}
	VariableMapPool = sync.Pool{
		New: func() interface{} {
			return make(map[string]interface{})
		},
	}
	ReversePool = sync.Pool{
		New: func() interface{} {
			return new(structs.Reverse)
		},
	}
)
View Source
var RequestsInvoke = func(target string, setMap map[string]interface{}, rule structs.Rule) bool {
	var req *http.Request
	var err error

	if rule.Request.Body == "" {
		req, err = http.NewRequest(rule.Request.Method, target+render(rule.Request.Path, setMap), nil)
	} else {
		req, err = http.NewRequest(rule.Request.Method, target+render(rule.Request.Path, setMap), bytes.NewBufferString(render(rule.Request.Body, setMap)))
	}

	for k, v := range setMap {
		vStr := fmt.Sprintf("%v", v)
		req.Header.Set(k, vStr)
	}

	if err != nil {
		gologger.Error().Msgf(fmt.Sprintf("http request error: %s", err.Error()))
		return false
	}
	tr := &http.Transport{
		TLSClientConfig: &tls.Config{InsecureSkipVerify: true},
	}
	client := &http.Client{Transport: tr}
	resp, err := client.Do(req)

	if err != nil {
		println(err.Error())
		return false
	}
	response := &structs.Response{}
	response.Body, _ = ioutil.ReadAll(resp.Body)
	response.Headers = headerToMap(resp.Header)
	response.Status = int32(resp.StatusCode)

	return execRuleExpression(rule.Expression, map[string]interface{}{"response": response})
}

Functions

func LoadTemplatesWithTags

func LoadTemplatesWithTags(templatesList, tags []string, ExcludeTags []string, Pocs embed.FS) []*templates.Template

func NucleiStart

func NucleiStart(target string, template []*templates.Template) []string

func XrayStart

func XrayStart(target string, pocs []*xray_structs.Poc) []string

Types

type RequestFuncType

type RequestFuncType func(ruleName string, rule xray_structs.Rule) error

type ReverseInfo added in v1.0.4

type ReverseInfo struct {
	Reverse *structs.Reverse
	Url     *structs.UrlType
}

定义一个自定义结构体,用于存储 Reverse 结构体和 Url 字段

type Rule

type Rule struct {
	Request    RuleRequest `yaml:"request"`
	Expression string      `yaml:"expression"`
}

type RuleRequest

type RuleRequest struct {
	Cache      bool              `yaml:"cache"`
	Method     string            `yaml:"method"`
	Path       string            `yaml:"path"`
	Headers    map[string]string `yaml:"headers"`
	Body       string            `yaml:"body"`
	Expression string            `yaml:"expression"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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