lib

package
v0.0.6 Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2022 License: MIT Imports: 32 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Client           *http.Client
	ClientNoRedirect *http.Client
)

Functions

func CheckMultiPoc

func CheckMultiPoc(req *http.Request, pocs []*Poc, workers int, info *common.HostInfo)

func Evaluate

func Evaluate(env *cel.Env, expression string, params map[string]interface{}) (ref.Val, error)

func InitHttpClient

func InitHttpClient(ThreadsNum int, Timeout time.Duration) error

func Inithttp

func Inithttp(num int, timeout int64)

func NewEnv

func NewEnv(c *CustomLib) (*cel.Env, error)

func RandomStr

func RandomStr(randSource *rand.Rand, letterBytes string, n int) string

func UrlTypeToString

func UrlTypeToString(u *UrlType) string

Types

type CustomLib

type CustomLib struct {
	// contains filtered or unexported fields
}

func NewEnvOption

func NewEnvOption() CustomLib

func (*CustomLib) CompileOptions

func (c *CustomLib) CompileOptions() []cel.EnvOption

声明环境中的变量类型和函数

func (*CustomLib) ProgramOptions

func (c *CustomLib) ProgramOptions() []cel.ProgramOption

func (*CustomLib) UpdateCompileOptions

func (c *CustomLib) UpdateCompileOptions(args map[string]string)

type Detail

type Detail struct {
	Links       []string `yaml:"links"`
	Description string   `yaml:"description"`
	Version     string   `yaml:"version"`
}

type Poc

type Poc struct {
	Name    string              `yaml:"name"`
	Set     map[string]string   `yaml:"set"`
	Sets    map[string][]string `yaml:"sets"`
	Rules   []Rules             `yaml:"rules"`
	Groups  map[string][]Rules  `yaml:"groups"`
	Exploit []Rules             `yaml:"exploit"`
	Exec    []Rules             `yaml:"exec"`
	Detail  Detail              `yaml:"detail"`
}

func LoadPoc

func LoadPoc(fileName string, Pocs embed.FS) (*Poc, error)

func LoadPocStr added in v0.0.2

func LoadPocStr(pocContent string) (*Poc, error)

type Request

type Request struct {
	Url                  *UrlType          `protobuf:"bytes,1,opt,name=url,proto3" json:"url,omitempty"`
	Method               string            `protobuf:"bytes,2,opt,name=method,proto3" json:"method,omitempty"`
	Headers              map[string]string `` /* 155-byte string literal not displayed */
	ContentType          string            `protobuf:"bytes,4,opt,name=content_type,json=contentType,proto3" json:"content_type,omitempty"`
	Body                 []byte            `protobuf:"bytes,5,opt,name=body,proto3" json:"body,omitempty"`
	XXX_NoUnkeyedLiteral struct{}          `json:"-"`
	XXX_unrecognized     []byte            `json:"-"`
	XXX_sizecache        int32             `json:"-"`
}

func ParseRequest

func ParseRequest(oReq *http.Request) (*Request, error)

func (*Request) Descriptor

func (*Request) Descriptor() ([]byte, []int)

func (*Request) GetBody

func (m *Request) GetBody() []byte

func (*Request) GetContentType

func (m *Request) GetContentType() string

func (*Request) GetHeaders

func (m *Request) GetHeaders() map[string]string

func (*Request) GetMethod

func (m *Request) GetMethod() string

func (*Request) GetUrl

func (m *Request) GetUrl() *UrlType

func (*Request) ProtoMessage

func (*Request) ProtoMessage()

func (*Request) Reset

func (m *Request) Reset()

func (*Request) String

func (m *Request) String() string

func (*Request) XXX_DiscardUnknown

func (m *Request) XXX_DiscardUnknown()

func (*Request) XXX_Marshal

func (m *Request) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Request) XXX_Merge

func (m *Request) XXX_Merge(src proto.Message)

func (*Request) XXX_Size

func (m *Request) XXX_Size() int

func (*Request) XXX_Unmarshal

func (m *Request) XXX_Unmarshal(b []byte) error

type Response

type Response struct {
	Url                  *UrlType          `protobuf:"bytes,1,opt,name=url,proto3" json:"url,omitempty"`
	Status               int32             `protobuf:"varint,2,opt,name=status,proto3" json:"status,omitempty"`
	Headers              map[string]string `` /* 155-byte string literal not displayed */
	ContentType          string            `protobuf:"bytes,4,opt,name=content_type,json=contentType,proto3" json:"content_type,omitempty"`
	Body                 []byte            `protobuf:"bytes,5,opt,name=body,proto3" json:"body,omitempty"`
	XXX_NoUnkeyedLiteral struct{}          `json:"-"`
	XXX_unrecognized     []byte            `json:"-"`
	XXX_sizecache        int32             `json:"-"`
}

func DoRequest

func DoRequest(req *http.Request, redirect bool) (*Response, error)

func ParseResponse

func ParseResponse(oResp *http.Response) (*Response, error)

func (*Response) Descriptor

func (*Response) Descriptor() ([]byte, []int)

func (*Response) GetBody

func (m *Response) GetBody() []byte

func (*Response) GetContentType

func (m *Response) GetContentType() string

func (*Response) GetHeaders

func (m *Response) GetHeaders() map[string]string

func (*Response) GetStatus

func (m *Response) GetStatus() int32

func (*Response) GetUrl

func (m *Response) GetUrl() *UrlType

func (*Response) ProtoMessage

func (*Response) ProtoMessage()

func (*Response) Reset

func (m *Response) Reset()

func (*Response) String

func (m *Response) String() string

func (*Response) XXX_DiscardUnknown

func (m *Response) XXX_DiscardUnknown()

func (*Response) XXX_Marshal

func (m *Response) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Response) XXX_Merge

func (m *Response) XXX_Merge(src proto.Message)

func (*Response) XXX_Size

func (m *Response) XXX_Size() int

func (*Response) XXX_Unmarshal

func (m *Response) XXX_Unmarshal(b []byte) error

type Rules

type Rules struct {
	Method          string            `yaml:"method"`
	Path            string            `yaml:"path"`
	Headers         map[string]string `yaml:"headers"`
	Body            string            `yaml:"body"`
	Search          string            `yaml:"search"`
	FollowRedirects bool              `yaml:"follow_redirects"`
	Expression      string            `yaml:"expression"`
}

type Task

type Task struct {
	Req *http.Request
	Poc *Poc
}

type UrlType

type UrlType struct {
	Scheme               string   `protobuf:"bytes,1,opt,name=scheme,proto3" json:"scheme,omitempty"`
	Domain               string   `protobuf:"bytes,2,opt,name=domain,proto3" json:"domain,omitempty"`
	Host                 string   `protobuf:"bytes,3,opt,name=host,proto3" json:"host,omitempty"`
	Port                 string   `protobuf:"bytes,4,opt,name=port,proto3" json:"port,omitempty"`
	Path                 string   `protobuf:"bytes,5,opt,name=path,proto3" json:"path,omitempty"`
	Query                string   `protobuf:"bytes,6,opt,name=query,proto3" json:"query,omitempty"`
	Fragment             string   `protobuf:"bytes,7,opt,name=fragment,proto3" json:"fragment,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func ParseUrl

func ParseUrl(u *url.URL) *UrlType

func (*UrlType) Descriptor

func (*UrlType) Descriptor() ([]byte, []int)

func (*UrlType) GetDomain

func (m *UrlType) GetDomain() string

func (*UrlType) GetFragment

func (m *UrlType) GetFragment() string

func (*UrlType) GetHost

func (m *UrlType) GetHost() string

func (*UrlType) GetPath

func (m *UrlType) GetPath() string

func (*UrlType) GetPort

func (m *UrlType) GetPort() string

func (*UrlType) GetQuery

func (m *UrlType) GetQuery() string

func (*UrlType) GetScheme

func (m *UrlType) GetScheme() string

func (*UrlType) ProtoMessage

func (*UrlType) ProtoMessage()

func (*UrlType) Reset

func (m *UrlType) Reset()

func (*UrlType) String

func (m *UrlType) String() string

func (*UrlType) XXX_DiscardUnknown

func (m *UrlType) XXX_DiscardUnknown()

func (*UrlType) XXX_Marshal

func (m *UrlType) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*UrlType) XXX_Merge

func (m *UrlType) XXX_Merge(src proto.Message)

func (*UrlType) XXX_Size

func (m *UrlType) XXX_Size() int

func (*UrlType) XXX_Unmarshal

func (m *UrlType) XXX_Unmarshal(b []byte) error

Jump to

Keyboard shortcuts

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