Skip to content

Commit

Permalink
changed Event API Channel -> Source
Browse files Browse the repository at this point in the history
Signed-off-by: Quentin JEROME <[email protected]>
  • Loading branch information
qjerome committed Nov 6, 2023
1 parent 8beea81 commit dfda88e
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
6 changes: 3 additions & 3 deletions engine/event.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ type Event interface {
SetDetection(d *Detection)
Get(*XPath) (interface{}, bool)
GetDetection() *Detection
Channel() string
Source() string
Computer() string
EventID() int64
Timestamp() time.Time
Expand Down Expand Up @@ -83,8 +83,8 @@ func (g GenericEvent) GetDetection() *Detection {
return nil
}

func (g GenericEvent) Channel() string {
p := g.Type().Channel
func (g GenericEvent) Source() string {
p := g.Type().Source
if ch, ok := EventGetString(g, p); ok {
return ch
}
Expand Down
2 changes: 1 addition & 1 deletion engine/event_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ func TestEvent(t *testing.T) {

tt.CheckErr(json.Unmarshal([]byte(eventStr), &evt))

tt.Assert(evt.Channel() == "Microsoft-Windows-Sysmon/Operational")
tt.Assert(evt.Source() == "Microsoft-Windows-Sysmon/Operational")
t.Log(evt.Computer())
tt.Assert(evt.Computer() == "DESKTOP-5SUA567")
ts, err := time.Parse(time.RFC3339Nano, "2017-01-19T16:09:30Z")
Expand Down
2 changes: 1 addition & 1 deletion engine/filters.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,5 +38,5 @@ func (f EventFilter) IsEmpty() bool {
}

func (f EventFilter) Match(e Event) bool {
return f.match(e.Channel(), e.EventID())
return f.match(e.Source(), e.EventID())
}
6 changes: 3 additions & 3 deletions engine/log_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ type NameConv int
type LogType struct {
FieldNameConv NameConv
Data *XPath
Channel *XPath
Source *XPath
EventID *XPath
Hostname *XPath
GeneInfo *XPath
Expand All @@ -37,7 +37,7 @@ var (
TypeWinevt = LogType{
FieldNameConv: CamelCase,
Data: eventDataPath,
Channel: systemPath.Append("Channel"),
Source: systemPath.Append("Channel"),
EventID: systemPath.Append("EventID"),
Hostname: systemPath.Append("Computer"),
GeneInfo: Path("/Event/GeneInfo"),
Expand All @@ -50,7 +50,7 @@ var (
TypeKunai = LogType{
FieldNameConv: SnakeCase,
Data: Path("/data"),
Channel: Path("/info/event/source"),
Source: Path("/info/event/source"),
EventID: Path("/info/event/id"),
Hostname: Path("/info/host/hostname"),
GeneInfo: Path("/gene_info"),
Expand Down

0 comments on commit dfda88e

Please sign in to comment.