rule

package
v1.2.8-sp5 Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2023 License: AGPL-3.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DecorateRules

func DecorateRules(concurrent int, proxy string)

func DeleteSuricataRuleByID

func DeleteSuricataRuleByID(db *gorm.DB, id int64) error

func ExportRulesToFile

func ExportRulesToFile(db *gorm.DB, fileName string) error

func ImportRulesFromFile

func ImportRulesFromFile(db *gorm.DB, fileName string) error

func SaveHTTPRequest

func SaveHTTPRequest(db *gorm.DB, name string, raw []byte) error

func SaveICMPTraffic

func SaveICMPTraffic(db *gorm.DB, name string, raw []byte) error

func SaveSuricata

func SaveSuricata(db *gorm.DB, s *rule.Rule) error

func SaveTCPTraffic

func SaveTCPTraffic(db *gorm.DB, name string, raw []byte) error

func UpsertRule

func UpsertRule(db *gorm.DB, hash string, i interface{}) error

func YieldRules

func YieldRules(db *gorm.DB, ctx context.Context) chan *Storage

Types

type Storage

type Storage struct {
	gorm.Model

	RawTrafficBeyondIPPacketBase64  string
	RawTrafficBeyondLinkLayerBase64 string
	RawTrafficBeyondHTTPBase64      string

	// suricata / http-request
	RuleType string

	SuricataRaw string `json:"raw"`
	Protocol    string
	Action      string
	Name        string
	NameZh      string
	ClassType   string
	ClassTypeZh string
	Group       string
	Hash        string `json:"hash" gorm:"unique_index"`

	Keywords      string
	KeywordsZh    string
	Description   string
	DescriptionZh string
	CVE           string
}

func GetSuricataChaosMakerRule

func GetSuricataChaosMakerRule(db *gorm.DB, id int64) (*Storage, error)

func NewHTTPRequestRule

func NewHTTPRequestRule(name string, raw []byte) *Storage

func NewRuleFromSuricata

func NewRuleFromSuricata(s *rule.Rule) *Storage

func (*Storage) BeforeSave

func (c *Storage) BeforeSave() error

func (*Storage) CalcHash

func (c *Storage) CalcHash() string

func (*Storage) DecoratedByOpenAI

func (c *Storage) DecoratedByOpenAI(db *gorm.DB, opts ...openai.ConfigOption)

func (Storage) TableName added in v1.2.7

func (Storage) TableName() string

func (*Storage) ToGPRCModel

func (c *Storage) ToGPRCModel() *ypb.ChaosMakerRule

Jump to

Keyboard shortcuts

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