rule

package
v1.5.0 Latest Latest
Warning

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

Go to latest
Published: Dec 28, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MatchWpPlugin

func MatchWpPlugin(banner *Banner) map[string]map[string]string

Types

type Banner struct {
	Uri         string               `json:"uri"`
	BodyHash    int32                `json:"body_hash"`
	Body        string               `json:"body"`
	Header      string               `json:"header"`
	Headers     map[string]string    `json:"-"`
	Title       string               `json:"title"`
	StatusCode  int                  `json:"status_code"`
	Response    string               `json:"_"`
	SSL         bool                 `json:"ssl"`
	Certificate string               `json:"certificate"`
	IconHash    int32                `json:"icon_hash"`
	IconType    string               `json:"icon_type"`
	Charset     string               `json:"-"`
	Cert        *tls.ConnectionState `json:"-"`
	IconURI     string               `json:"icon_uri"`
	IconBytes   []byte               `json:"-"`
}

type Finger

type Finger struct {
	Rules map[string][]*Rule `yaml:"rules"`
}

Finger 根据协议分组

func NewFinger

func NewFinger() *Finger

func ScanRuleDirectory

func ScanRuleDirectory(directory string) (*Finger, error)

func (Finger) AddRules

func (f Finger) AddRules(rules []*Rule)

func (Finger) Match

func (f Finger) Match(service string, banner *Banner) map[string]map[string]string

type Plugin

type Plugin struct {
	Path string `yaml:"path" json:"path,omitempty"`
}

type Rule

type Rule struct {
	Name              string `json:"name,omitempty"`
	Service           string `yaml:"service" json:"service,omitempty"`
	MatchersCondition string `yaml:"matchers-condition" json:"matchers_condition,omitempty"`
	// 组件太多  采用层级匹配 优化匹配速度
	Require  []string               `json:"require,omitempty"`
	Matchers []*matchers.Matcher    `json:"matchers,omitempty"`
	Plugins  []*Plugin              `yaml:"plugins"`
	Cpe      map[string]interface{} `yaml:"cpe" json:"cpe,omitempty"`
}

func LoadRule

func LoadRule(filename string) ([]*Rule, error)

func (*Rule) Match

func (r *Rule) Match(banner *Banner) (bool, map[string]string)

Jump to

Keyboard shortcuts

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