forked from gojue/ecapture
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathevent_gossl.go
65 lines (52 loc) · 1.22 KB
/
event_gossl.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
// Copyright © 2022 Hengqi Chen
package user
import (
"bytes"
"ecapture/pkg/event_processor"
"encoding/binary"
"fmt"
)
type inner struct {
TimestampNS uint64
Pid uint32
Tid uint32
Len int32
Comm [16]byte
Data [4096]byte
}
type goSSLEvent struct {
m IModule
inner
}
func (e *goSSLEvent) Decode(payload []byte) error {
r := bytes.NewBuffer(payload)
return binary.Read(r, binary.LittleEndian, &e.inner)
}
func (e *goSSLEvent) String() string {
s := fmt.Sprintf("PID: %d, Comm: %s, TID: %d, Payload: %s\n", e.Pid, string(e.Comm[:]), e.Tid, string(e.Data[:e.Len]))
return s
}
func (e *goSSLEvent) StringHex() string {
return e.String()
}
func (e *goSSLEvent) Clone() event_processor.IEventStruct {
return &goSSLEvent{}
}
func (e *goSSLEvent) Module() IModule {
return e.m
}
func (e *goSSLEvent) SetModule(m IModule) {
e.m = m
}
func (e *goSSLEvent) EventType() event_processor.EVENT_TYPE {
return event_processor.EVENT_TYPE_OUTPUT
}
func (this *goSSLEvent) GetUUID() string {
return fmt.Sprintf("%d_%d_%s", this.Pid, this.Tid, this.Comm)
}
func (this *goSSLEvent) Payload() []byte {
return this.Data[:this.Len]
}
func (this *goSSLEvent) PayloadLen() int {
return int(this.Len)
}