xraypocv1

package
v0.0.0-...-7ef1397 Latest Latest
Warning

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

Go to latest
Published: Mar 6, 2024 License: Apache-2.0 Imports: 28 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

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

Functions

func CheckPoc

func CheckPoc(req *http.Request, pocBody []byte, content Content) (bool, string)

func Evaluate

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

func Execute

func Execute(addr string, pocBody []byte, content Content) (bool, string)

func GetHeader

func GetHeader(header map[string]string) (output string)

func GetKhtxt

func GetKhtxt(rules_txt string) []string

func GetOneRule

func GetOneRule(ruletxt string) []string

获取单个规则属性

func InCollections

func InCollections(s1 []string, s2 string) bool

func InitHttpClient

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

func IsContain

func IsContain(items []string, item string) bool

func MatchRuleOpt

func MatchRuleOpt(rule []string, content Content) bool

func MatchRules

func MatchRules(rules RuleStruct, content Content) bool

func NewEnv

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

func RandomStr

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

func SelectPoc

func SelectPoc(Pocs embed.FS, pocname string) []string

func UrlTypeToString

func UrlTypeToString(u *UrlType) string

Types

type Content

type Content struct {
	App      string
	Port     string
	Body     string
	Header   string
	Banner   string
	Server   string
	Title    string
	Protocol string
	Product  string
	Cert     string
}

func (Content) GetInfo

func (c Content) GetInfo(s1 string) string

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 {
	Author      string   `yaml:"author"`
	Links       []string `yaml:"links"`
	Description string   `yaml:"description"`
	Version     string   `yaml:"version"`
}

type KhIndex

type KhIndex struct {
	L int
	R int
}

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"`
	Detail Detail              `yaml:"detail"`
	Query  string              `yaml:"query"`
}

func LoadPocbyPath

func LoadPocbyPath(fileName 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 Reverse

type Reverse struct {
	Url                  *UrlType `protobuf:"bytes,1,opt,name=url,proto3" json:"url,omitempty"`
	Domain               string   `protobuf:"bytes,2,opt,name=domain,proto3" json:"domain,omitempty"`
	Ip                   string   `protobuf:"bytes,3,opt,name=ip,proto3" json:"ip,omitempty"`
	IsDomainNameServer   bool     `protobuf:"varint,4,opt,name=is_domain_name_server,json=isDomainNameServer,proto3" json:"is_domain_name_server,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*Reverse) Descriptor

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

func (*Reverse) GetDomain

func (m *Reverse) GetDomain() string

func (*Reverse) GetIp

func (m *Reverse) GetIp() string

func (*Reverse) GetIsDomainNameServer

func (m *Reverse) GetIsDomainNameServer() bool

func (*Reverse) GetUrl

func (m *Reverse) GetUrl() *UrlType

func (*Reverse) ProtoMessage

func (*Reverse) ProtoMessage()

func (*Reverse) Reset

func (m *Reverse) Reset()

func (*Reverse) String

func (m *Reverse) String() string

func (*Reverse) XXX_DiscardUnknown

func (m *Reverse) XXX_DiscardUnknown()

func (*Reverse) XXX_Marshal

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

func (*Reverse) XXX_Merge

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

func (*Reverse) XXX_Size

func (m *Reverse) XXX_Size() int

func (*Reverse) XXX_Unmarshal

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

type RuleStruct

type RuleStruct struct {
	Opt     string
	Rules   [][]string
	SubRule []RuleStruct
}

func ParseRules

func ParseRules(ruleTxt string) *RuleStruct

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