rule

package
v1.3.4-beta7 Latest Latest
Warning

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

Go to latest
Published: Jul 5, 2024 License: AGPL-3.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ConstProtocol = "protocol"
	ConstMd5      = "md5"
	ConstHeader   = "header"
	ConstHeaders  = "headers"
	ConstBody     = "body"
	ConstTitle    = "title"
	ConstServer   = "server"
	ConstBanner   = "banner"
	ConstPort     = "port"
	ConstPath     = "path"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type CPE

type CPE struct {
	Part     string `yaml:"part,omitempty" json:"part"`
	Vendor   string `yaml:"vendor,omitempty" json:"vendor"`
	Product  string `yaml:"product,omitempty" json:"product"`
	Version  string `yaml:"version,omitempty" json:"version"`
	Update   string `yaml:"update,omitempty" json:"update"`
	Edition  string `yaml:"edition,omitempty" json:"edition"`
	Language string `yaml:"language,omitempty" json:"language"`
}

func Execute

func Execute(getter func(path string) (*MatchResource, error), rule *FingerPrintRule) (cpe *CPE, err error)

func ParseToCPE

func ParseToCPE(cpe string) (*CPE, error)

func (*CPE) Init

func (c *CPE) Init()

func (*CPE) String

func (c *CPE) String() string

type FingerPrintRule

type FingerPrintRule struct {
	Method     string
	WebPath    string
	MatchParam *MatchMethodParam
	// contains filtered or unexported fields
}

func NewEmptyFingerPrintRule

func NewEmptyFingerPrintRule() *FingerPrintRule

func (*FingerPrintRule) ToOpCodes

func (f *FingerPrintRule) ToOpCodes() []*OpCode

type GeneralRule

type GeneralRule struct {
	gorm.Model
	*CPE
	WebPath         string
	ExtInfo         string
	MatchExpression string `gorm:"uniqueIndex"`
}

func DecompileFingerprintRuleOpCodes

func DecompileFingerprintRuleOpCodes(codes []*OpCode) (*GeneralRule, error)

func NewEmptyGeneralRule

func NewEmptyGeneralRule() *GeneralRule

func ParseGeneralRule

func ParseGeneralRule(s string) (*GeneralRule, error)

func (*GeneralRule) String

func (g *GeneralRule) String() string

type MatchMethodParam

type MatchMethodParam struct {
	ExtParams map[string]any
	Info      *CPE

	// regexp
	RegexpPattern string
	Keyword       *webfingerprint.KeywordMatcher

	// complex
	Condition string
	SubRules  []*FingerPrintRule

	// http header
	HeaderKey       string
	HeaderMatchRule *FingerPrintRule

	//md5
	Md5 string

	// exp
	Params []any
	Op     string
}

type MatchResource

type MatchResource struct {
	Data     []byte
	Port     int
	Path     string
	Protocol string
}

func NewHttpResource

func NewHttpResource(data []byte) *MatchResource

type OpCode

type OpCode struct {
	Op OpFlag
	// contains filtered or unexported fields
}

type OpFlag

type OpFlag string
const (
	OpInfo        OpFlag = "info"
	OpData        OpFlag = "data"
	OpExtractData OpFlag = "extract_data"
	OpPush        OpFlag = "push"
	OpOr          OpFlag = "or"
	OpAnd         OpFlag = "and"

	OpNot         OpFlag = "not"
	OpEqual       OpFlag = "equal"
	OpContains    OpFlag = "contains"
	OpRegexpMatch OpFlag = "regexp_match"
)

Jump to

Keyboard shortcuts

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