rule

package
v1.3.5-alpha0802 Latest Latest
Warning

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

Go to latest
Published: Aug 2, 2024 License: AGPL-3.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DecorateRules

func DecorateRules(t string, 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 SaveToDB added in v1.3.2

func SaveToDB(rule *Storage) 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 `json:"raw_traffic_beyond_ip_packet_base64"`
	RawTrafficBeyondLinkLayerBase64 string `json:"raw_traffic_beyond_link_layer_base64"`
	RawTrafficBeyondHTTPBase64      string `json:"raw_traffic_beyond_http_base64"`

	// suricata / http-request
	RuleType string `json:"rule_type"`

	SuricataRaw string `json:"raw"`
	Protocol    string `json:"protocol"`
	Action      string `json:"action"`
	Name        string `json:"name"`
	NameZh      string `json:"name_zh"`
	ClassType   string `json:"class_type"`
	ClassTypeZh string `json:"class_type_zh"`
	Group       string `json:"group"`
	Hash        string `json:"hash" gorm:"unique_index"`

	Keywords      string `json:"keywords"`
	KeywordsZh    string `json:"keywords_zh"`
	Description   string `json:"description"`
	DescriptionZh string `json:"description_zh"`

	RuleUpdatedAt      string `json:"origin_updated_at"`
	RuleCreatedAt      string `json:"origin_created_at"`
	Deployment         string `json:"deployment"`
	SignatureSeverity  string `json:"signature_severity"`
	AttackTarget       string `json:"attack_target"`
	FormerCategory     string `json:"former_category"`
	AffectedProduct    string `json:"affected_product"`
	Tag                string `json:"tag"`
	PerformanceImpact  string `json:"performance_impact"`
	MalwareFamily      string `json:"malware_family"`
	MitreTechniqueID   string `json:"mitre_technique_id"`
	MitreTacticID      string `json:"mitre_tactic_id"`
	MitreTechniqueName string `json:"mitre_technique_name"`
	MitreTacticName    string `json:"mitre_tactic_name"`
	Confidence         string `json:"confidence"`
	ReviewedAt         string `json:"reviewed_at"`
	CVE                string `json:"cve"`
}

func GetSuricataChaosMakerRule

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

func GetSuricataChaosMakerRuleByHash added in v1.3.2

func GetSuricataChaosMakerRuleByHash(db *gorm.DB, hash string) (*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 (origin *Storage) DecoratedByOpenAI(t string, opts ...aispec.AIConfigOption)

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