RuleClient

package
v0.1.4 Latest Latest
Warning

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

Go to latest
Published: Jul 10, 2025 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Up   = "up"
	Down = "down"
)

Variables

View Source
var ExeFs embed.FS
View Source
var FingerFilesMap = map[string][]string{
	"full":    {"Firewall.yaml,", "MailServer.yaml", "lowLevel.yaml", "fofa_fingerprints.yaml", "oaSystem.yaml", "other.yaml", "p1_fingerprints.yaml", "supply.yaml", "webApp.yaml"},
	"redteam": {"Firewall.yaml,", "MailServer.yaml", "oaSystem.yaml", "webApp.yaml"},
}

Functions

func CheckHttpPrefix

func CheckHttpPrefix(check string) (checked string, err error)

func CheckProtocol

func CheckProtocol(host string, port string) (string, error)

CheckProtocol 检查给定主机和端口的协议类型(HTTP或HTTPS)

func CheckProtocolByIp

func CheckProtocolByIp(ip string) string

func SaveToCsv

func SaveToCsv(targetFingerRsts []DetectResult, outputFile string) error

func SaveToExcel

func SaveToExcel(targetFingerRsts []DetectResult, outputFile string) error

func SaveToFile

func SaveToFile(DetectResult []DetectResult, output string) (err error)

func SliceRmDuplication

func SliceRmDuplication[T comparable](old []T) []T

切片去重 使用泛型来去除切片中的重复元素 go > 1.18

Types

type DetectResult

type DetectResult struct {
	Host                string `json:"host"`
	OriginUrl           string `json:"origin_target"`
	OriginUrlStatusCode int    `json:"origin_url_status_code"`
	OriginWebTitle      string `json:"web_title"` //Important

	RedirectUrl           string `json:"redirect_url"`
	RedirectUrlStatusCode int    `json:"redirect_url_status_code"`
	RedirectWebTitle      string `json:"redirect_web_title"`

	ContentLength  string   `json:"content_length"`
	SiteUp         string   `json:"site_up"`
	FingerTag      []string `json:"finger_tag"`     //Important
	LastUpdateTime string   `json:"lastupdatetime"` //Important
}

type DetectResultTdSafeType

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

func (*DetectResultTdSafeType) AddElement

func (s *DetectResultTdSafeType) AddElement(elem DetectResult)

func (*DetectResultTdSafeType) GetElements

func (s *DetectResultTdSafeType) GetElements() []DetectResult

type FingerPrintsTdSafeType

type FingerPrintsTdSafeType struct {
	FingerSlice []FingerprintsType
	// contains filtered or unexported fields
}

func (*FingerPrintsTdSafeType) AddElement

func (s *FingerPrintsTdSafeType) AddElement(elem FingerprintsType)

func (*FingerPrintsTdSafeType) GetElements

func (s *FingerPrintsTdSafeType) GetElements() []FingerprintsType

type FingerprintsType

type FingerprintsType struct {
	ID          string        `yaml:"id"`
	Name        string        `yaml:"name"`
	FingerFile  string        `yaml:"fingerFile"` //所属指纹文件
	Author      string        `yaml:"author"`
	Tags        []string      `yaml:"tags"`
	Description string        `yaml:"description"`
	Matchers    []MatcherType `yaml:"matchers"`
}

type MatcherType

type MatcherType struct {
	Location        string   `yaml:"location,omitempty"`
	Path            string   `yaml:"path"`
	Type            string   `yaml:"type,omitempty"`
	Words           []string `yaml:"words,omitempty"`
	FaviconHash     []string `yaml:"hash,omitempty"`
	BodyHash        string   `yaml:"bodyHash,omitempty"`
	Accuracy        string   `yaml:"accuracy"`
	Condition       string   `yaml:"condition,omitempty"`
	CaseInsensitive bool     `yaml:"case-insensitive,omitempty"`
}

type RuleClient

type RuleClient struct {
	DefaultFingerPath string                 // 默认指纹库路径
	P1FingerPrints    FingerPrintsTdSafeType // P1finger指纹库
	RuleMode          string

	ProxyUrl              string       // 可选 代理地址
	ProxyClient           *http.Client // http客户端 默认跟随重定向
	ProxyNoRedirectCilent *http.Client // http客户端 默认禁止跟随重定向

	OutputFormat string // 可选 输出格式

	DetectRstTdSafe DetectResultTdSafeType
}

func (*RuleClient) Detect

func (r *RuleClient) Detect(target string) (DetectRst DetectResult, err error)

func (*RuleClient) LoadFingersFromEXEFS

func (r *RuleClient) LoadFingersFromEXEFS(fingerFiles []string) (err error)

func (*RuleClient) LoadFingersFromExEfs

func (r *RuleClient) LoadFingersFromExEfs() (err error)

type RuleClientBuilder

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

func NewRuleClientBuilder

func NewRuleClientBuilder() *RuleClientBuilder

func (*RuleClientBuilder) Build

func (b *RuleClientBuilder) Build() (_ *RuleClient, err error)

func (*RuleClientBuilder) WithOutputFormat

func (b *RuleClientBuilder) WithOutputFormat(format string) *RuleClientBuilder

func (*RuleClientBuilder) WithProxyURL

func (b *RuleClientBuilder) WithProxyURL(url string) *RuleClientBuilder

func (*RuleClientBuilder) WithRuleMode

func (b *RuleClientBuilder) WithRuleMode(ruleMode string) *RuleClientBuilder

func (*RuleClientBuilder) WithTimeout

func (b *RuleClientBuilder) WithTimeout(t time.Duration) *RuleClientBuilder

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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