-
Notifications
You must be signed in to change notification settings - Fork 362
/
Copy pathtesting.go
109 lines (99 loc) · 2.86 KB
/
testing.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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
package config
import (
"github.com/creasty/defaults"
)
const testConfig = `
MongoDB:
ConnectionString: null
AuthenticationMechanism: null
SocketTimeout: 2
TLS:
Enable: false
VerifyCertificate: false
CAFile: null
MetaDB: RITA-TEST-MetaDatabase
LogConfig:
LogLevel: 3
RitaLogPath: null
LogToFile: false
LogToDB: true
UserConfig:
UpdateCheckFrequency: 14
BlackListed:
myIP.ms: false
MalwareDomains.com: false
MalwareDomainList.com: false
CustomIPBlacklists: []
CustomHostnameBlacklists: []
DNS:
Enabled: true
Beacon:
Enabled: true
DefaultConnectionThresh: 23
TimestampScoreWeight: 0.25
DatasizeScoreWeight: 0.25
DurationScoreWeight: 0.25
HistogramScoreWeight: 0.25
DurationMinHoursSeen: 6
DurationConsistencyIdealHoursSeen: 12
HistogramBimodalBucketSize: 0.05
HistogramBimodalOutlierRemoval: 1
HistogramBimodalMinHoursSeen: 11
BeaconSNI:
Enabled: true
DefaultConnectionThresh: 23
TimestampScoreWeight: 0.25
DatasizeScoreWeight: 0.25
DurationScoreWeight: 0.25
HistogramScoreWeight: 0.25
DurationMinHoursSeen: 6
DurationConsistencyIdealHoursSeen: 12
HistogramBimodalBucketSize: 0.05
HistogramBimodalOutlierRemoval: 1
HistogramBimodalMinHoursSeen: 11
BeaconProxy:
Enabled: true
DefaultConnectionThresh: 23
TimestampScoreWeight: 0.333
DurationScoreWeight: 0.333
HistogramScoreWeight: 0.333
DurationMinHoursSeen: 6
DurationConsistencyIdealHoursSeen: 12
HistogramBimodalBucketSize: 0.05
HistogramBimodalOutlierRemoval: 1
HistogramBimodalMinHoursSeen: 11
Strobe:
ConnectionLimit: 250000
Filtering:
AlwaysInclude: ["8.8.8.8/32"]
NeverInclude: ["8.8.4.4/32"]
InternalSubnets: ["10.0.0.0/8","172.16.0.0/12","192.168.0.0/16"]
HTTPProxyServers: ["1.1.1.1", "1.1.1.2/32", "1.2.0.0/16"]
AlwaysIncludeDomain: ["bad.com", "google.com", "*.myotherdomain.com"]
NeverIncludeDomain: ["good.com", "google.com", "*.mydomain.com"]
FilterExternalToInternal: false
`
// LoadTestingConfig loads the hard coded testing config
func LoadTestingConfig(mongoURI string) (*Config, error) {
config := &Config{}
// Initialize table config to the default values
if err := defaults.Set(&config.T); err != nil {
return nil, err
}
// Initialize static config to the default values
if err := defaults.Set(&config.S); err != nil {
return nil, err
}
config.S.MongoDB.ConnectionString = mongoURI
// Deserialize the yaml file contents into the static config
if err := parseStaticConfig([]byte(testConfig), &config.S); err != nil {
return nil, err
}
config.S.Version = "v0.0.0+testing"
config.S.ExactVersion = "v0.0.0+testing"
// Use the static config to initialize the running config
if err := initRunningConfig(&config.S, &config.R); err != nil {
return nil, err
}
return config, nil
}