forked from 0xrawsec/whids
-
Notifications
You must be signed in to change notification settings - Fork 0
/
default.go
81 lines (55 loc) · 2.03 KB
/
default.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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
package sysmon
import (
"encoding/xml"
"fmt"
"github.com/0xrawsec/whids/los"
)
var (
agnosticConfig = `<Sysmon schemaversion="%s">
<HashAlgorithms>*</HashAlgorithms>
<EventFiltering>
<ProcessCreate onmatch="exclude"></ProcessCreate>
<FileCreateTime onmatch="exclude"></FileCreateTime>
<NetworkConnect onmatch="exclude"></NetworkConnect>
<ProcessTerminate onmatch="exclude"></ProcessTerminate>
<DriverLoad onmatch="exclude"></DriverLoad>
<CreateRemoteThread onmatch="exclude"></CreateRemoteThread>
<RawAccessRead onmatch="exclude"></RawAccessRead>
<FileCreate onmatch="exclude"></FileCreate>
<FileCreateStreamHash onmatch="exclude"></FileCreateStreamHash>
<PipeEvent onmatch="exclude"></PipeEvent>
<WmiEvent onmatch="exclude"></WmiEvent>
<FileDelete onmatch="exclude"></FileDelete>
<ClipboardChange onmatch="exclude"></ClipboardChange>
<ProcessTampering onmatch="exclude"></ProcessTampering>
<FileDeleteDetected onmatch="exclude"></FileDeleteDetected>
<ImageLoad onmatch="exclude"></ImageLoad>
<ProcessAccess onmatch="exclude">
<GrantedAccess condition="is">0x1000</GrantedAccess>
<GrantedAccess condition="is">0x1400</GrantedAccess>
<GrantedAccess condition="is">0x2000</GrantedAccess>
<GrantedAccess condition="is">0x3000</GrantedAccess>
<GrantedAccess condition="is">0x100000</GrantedAccess>
<GrantedAccess condition="is">0x101000</GrantedAccess>
</ProcessAccess>
<RegistryEvent onmatch="exclude">
<EventType condition="is not">SetValue</EventType>
</RegistryEvent>
<DnsQuery onmatch="exclude"></DnsQuery>
</EventFiltering>
</Sysmon>`
)
func AgnosticConfig(schemaversion string) (c *Config, err error) {
config := []byte(fmt.Sprintf(agnosticConfig, schemaversion))
if err = xml.Unmarshal(config, &c); err != nil {
return
}
// set sha256 of config structure
if c.XmlSha256, err = c.Sha256(); err != nil {
return
}
// Config struct needs a valid OS to be validated
c.OS = los.OS
err = c.Validate()
return
}