-
Notifications
You must be signed in to change notification settings - Fork 40
/
constants.go
271 lines (234 loc) · 8.83 KB
/
constants.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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
package incidents
import "strings"
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See NOTICE.txt in the project root for license information.
type AttackTactic string
const (
AttackTacticCollection AttackTactic = "Collection"
AttackTacticCommandAndControl AttackTactic = "CommandAndControl"
AttackTacticCredentialAccess AttackTactic = "CredentialAccess"
AttackTacticDefenseEvasion AttackTactic = "DefenseEvasion"
AttackTacticDiscovery AttackTactic = "Discovery"
AttackTacticExecution AttackTactic = "Execution"
AttackTacticExfiltration AttackTactic = "Exfiltration"
AttackTacticImpact AttackTactic = "Impact"
AttackTacticImpairProcessControl AttackTactic = "ImpairProcessControl"
AttackTacticInhibitResponseFunction AttackTactic = "InhibitResponseFunction"
AttackTacticInitialAccess AttackTactic = "InitialAccess"
AttackTacticLateralMovement AttackTactic = "LateralMovement"
AttackTacticPersistence AttackTactic = "Persistence"
AttackTacticPreAttack AttackTactic = "PreAttack"
AttackTacticPrivilegeEscalation AttackTactic = "PrivilegeEscalation"
AttackTacticReconnaissance AttackTactic = "Reconnaissance"
AttackTacticResourceDevelopment AttackTactic = "ResourceDevelopment"
)
func PossibleValuesForAttackTactic() []string {
return []string{
string(AttackTacticCollection),
string(AttackTacticCommandAndControl),
string(AttackTacticCredentialAccess),
string(AttackTacticDefenseEvasion),
string(AttackTacticDiscovery),
string(AttackTacticExecution),
string(AttackTacticExfiltration),
string(AttackTacticImpact),
string(AttackTacticImpairProcessControl),
string(AttackTacticInhibitResponseFunction),
string(AttackTacticInitialAccess),
string(AttackTacticLateralMovement),
string(AttackTacticPersistence),
string(AttackTacticPreAttack),
string(AttackTacticPrivilegeEscalation),
string(AttackTacticReconnaissance),
string(AttackTacticResourceDevelopment),
}
}
func parseAttackTactic(input string) (*AttackTactic, error) {
vals := map[string]AttackTactic{
"collection": AttackTacticCollection,
"commandandcontrol": AttackTacticCommandAndControl,
"credentialaccess": AttackTacticCredentialAccess,
"defenseevasion": AttackTacticDefenseEvasion,
"discovery": AttackTacticDiscovery,
"execution": AttackTacticExecution,
"exfiltration": AttackTacticExfiltration,
"impact": AttackTacticImpact,
"impairprocesscontrol": AttackTacticImpairProcessControl,
"inhibitresponsefunction": AttackTacticInhibitResponseFunction,
"initialaccess": AttackTacticInitialAccess,
"lateralmovement": AttackTacticLateralMovement,
"persistence": AttackTacticPersistence,
"preattack": AttackTacticPreAttack,
"privilegeescalation": AttackTacticPrivilegeEscalation,
"reconnaissance": AttackTacticReconnaissance,
"resourcedevelopment": AttackTacticResourceDevelopment,
}
if v, ok := vals[strings.ToLower(input)]; ok {
return &v, nil
}
// otherwise presume it's an undefined value and best-effort it
out := AttackTactic(input)
return &out, nil
}
type IncidentClassification string
const (
IncidentClassificationBenignPositive IncidentClassification = "BenignPositive"
IncidentClassificationFalsePositive IncidentClassification = "FalsePositive"
IncidentClassificationTruePositive IncidentClassification = "TruePositive"
IncidentClassificationUndetermined IncidentClassification = "Undetermined"
)
func PossibleValuesForIncidentClassification() []string {
return []string{
string(IncidentClassificationBenignPositive),
string(IncidentClassificationFalsePositive),
string(IncidentClassificationTruePositive),
string(IncidentClassificationUndetermined),
}
}
func parseIncidentClassification(input string) (*IncidentClassification, error) {
vals := map[string]IncidentClassification{
"benignpositive": IncidentClassificationBenignPositive,
"falsepositive": IncidentClassificationFalsePositive,
"truepositive": IncidentClassificationTruePositive,
"undetermined": IncidentClassificationUndetermined,
}
if v, ok := vals[strings.ToLower(input)]; ok {
return &v, nil
}
// otherwise presume it's an undefined value and best-effort it
out := IncidentClassification(input)
return &out, nil
}
type IncidentClassificationReason string
const (
IncidentClassificationReasonInaccurateData IncidentClassificationReason = "InaccurateData"
IncidentClassificationReasonIncorrectAlertLogic IncidentClassificationReason = "IncorrectAlertLogic"
IncidentClassificationReasonSuspiciousActivity IncidentClassificationReason = "SuspiciousActivity"
IncidentClassificationReasonSuspiciousButExpected IncidentClassificationReason = "SuspiciousButExpected"
)
func PossibleValuesForIncidentClassificationReason() []string {
return []string{
string(IncidentClassificationReasonInaccurateData),
string(IncidentClassificationReasonIncorrectAlertLogic),
string(IncidentClassificationReasonSuspiciousActivity),
string(IncidentClassificationReasonSuspiciousButExpected),
}
}
func parseIncidentClassificationReason(input string) (*IncidentClassificationReason, error) {
vals := map[string]IncidentClassificationReason{
"inaccuratedata": IncidentClassificationReasonInaccurateData,
"incorrectalertlogic": IncidentClassificationReasonIncorrectAlertLogic,
"suspiciousactivity": IncidentClassificationReasonSuspiciousActivity,
"suspiciousbutexpected": IncidentClassificationReasonSuspiciousButExpected,
}
if v, ok := vals[strings.ToLower(input)]; ok {
return &v, nil
}
// otherwise presume it's an undefined value and best-effort it
out := IncidentClassificationReason(input)
return &out, nil
}
type IncidentLabelType string
const (
IncidentLabelTypeAutoAssigned IncidentLabelType = "AutoAssigned"
IncidentLabelTypeUser IncidentLabelType = "User"
)
func PossibleValuesForIncidentLabelType() []string {
return []string{
string(IncidentLabelTypeAutoAssigned),
string(IncidentLabelTypeUser),
}
}
func parseIncidentLabelType(input string) (*IncidentLabelType, error) {
vals := map[string]IncidentLabelType{
"autoassigned": IncidentLabelTypeAutoAssigned,
"user": IncidentLabelTypeUser,
}
if v, ok := vals[strings.ToLower(input)]; ok {
return &v, nil
}
// otherwise presume it's an undefined value and best-effort it
out := IncidentLabelType(input)
return &out, nil
}
type IncidentSeverity string
const (
IncidentSeverityHigh IncidentSeverity = "High"
IncidentSeverityInformational IncidentSeverity = "Informational"
IncidentSeverityLow IncidentSeverity = "Low"
IncidentSeverityMedium IncidentSeverity = "Medium"
)
func PossibleValuesForIncidentSeverity() []string {
return []string{
string(IncidentSeverityHigh),
string(IncidentSeverityInformational),
string(IncidentSeverityLow),
string(IncidentSeverityMedium),
}
}
func parseIncidentSeverity(input string) (*IncidentSeverity, error) {
vals := map[string]IncidentSeverity{
"high": IncidentSeverityHigh,
"informational": IncidentSeverityInformational,
"low": IncidentSeverityLow,
"medium": IncidentSeverityMedium,
}
if v, ok := vals[strings.ToLower(input)]; ok {
return &v, nil
}
// otherwise presume it's an undefined value and best-effort it
out := IncidentSeverity(input)
return &out, nil
}
type IncidentStatus string
const (
IncidentStatusActive IncidentStatus = "Active"
IncidentStatusClosed IncidentStatus = "Closed"
IncidentStatusNew IncidentStatus = "New"
)
func PossibleValuesForIncidentStatus() []string {
return []string{
string(IncidentStatusActive),
string(IncidentStatusClosed),
string(IncidentStatusNew),
}
}
func parseIncidentStatus(input string) (*IncidentStatus, error) {
vals := map[string]IncidentStatus{
"active": IncidentStatusActive,
"closed": IncidentStatusClosed,
"new": IncidentStatusNew,
}
if v, ok := vals[strings.ToLower(input)]; ok {
return &v, nil
}
// otherwise presume it's an undefined value and best-effort it
out := IncidentStatus(input)
return &out, nil
}
type OwnerType string
const (
OwnerTypeGroup OwnerType = "Group"
OwnerTypeUnknown OwnerType = "Unknown"
OwnerTypeUser OwnerType = "User"
)
func PossibleValuesForOwnerType() []string {
return []string{
string(OwnerTypeGroup),
string(OwnerTypeUnknown),
string(OwnerTypeUser),
}
}
func parseOwnerType(input string) (*OwnerType, error) {
vals := map[string]OwnerType{
"group": OwnerTypeGroup,
"unknown": OwnerTypeUnknown,
"user": OwnerTypeUser,
}
if v, ok := vals[strings.ToLower(input)]; ok {
return &v, nil
}
// otherwise presume it's an undefined value and best-effort it
out := OwnerType(input)
return &out, nil
}