feat: 修改元数据
This commit is contained in:
parent
55c7c4edb3
commit
9602d42d7d
@ -89,3 +89,16 @@ type Rule interface {
|
|||||||
RuleExtra() *RuleExtra
|
RuleExtra() *RuleExtra
|
||||||
SetRuleExtra(re *RuleExtra)
|
SetRuleExtra(re *RuleExtra)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type JSMetadata struct {
|
||||||
|
Type string `json:"type"`
|
||||||
|
Network string `json:"network"`
|
||||||
|
Host string `json:"host"`
|
||||||
|
SrcIP string `json:"srcIP"`
|
||||||
|
DstIP string `json:"dstIP"`
|
||||||
|
SrcPort string `json:"srcPort"`
|
||||||
|
DstPort string `json:"dstPort"`
|
||||||
|
Uid *int32 `json:"uid"`
|
||||||
|
Process string `json:"process"`
|
||||||
|
ProcessPath string `json:"processPath"`
|
||||||
|
}
|
||||||
|
@ -19,7 +19,17 @@ func (s *Script) RuleType() C.RuleType {
|
|||||||
func (s *Script) Match(metadata *C.Metadata) bool {
|
func (s *Script) Match(metadata *C.Metadata) bool {
|
||||||
res := false
|
res := false
|
||||||
js.Run(s.name, map[string]any{
|
js.Run(s.name, map[string]any{
|
||||||
"metadata": metadata,
|
"metadata": C.JSMetadata{
|
||||||
|
Host: metadata.Host,
|
||||||
|
Network: metadata.NetWork.String(),
|
||||||
|
Type: metadata.Type.String(),
|
||||||
|
SrcIP: metadata.SrcIP.String(),
|
||||||
|
SrcPort: metadata.SrcPort,
|
||||||
|
DstPort: metadata.DstPort,
|
||||||
|
Uid: metadata.Uid,
|
||||||
|
Process: metadata.Process,
|
||||||
|
ProcessPath: metadata.ProcessPath,
|
||||||
|
},
|
||||||
}, func(a any, err error) {
|
}, func(a any, err error) {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
res = false
|
res = false
|
||||||
@ -29,7 +39,6 @@ func (s *Script) Match(metadata *C.Metadata) bool {
|
|||||||
if !ok {
|
if !ok {
|
||||||
res = false
|
res = false
|
||||||
}
|
}
|
||||||
|
|
||||||
res = r
|
res = r
|
||||||
})
|
})
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user