-
Notifications
You must be signed in to change notification settings - Fork 1
/
CLIConfig.cs
312 lines (289 loc) · 7.45 KB
/
CLIConfig.cs
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
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
using System;
using System.Collections.Generic;
namespace Symantec.CWoC {
public enum config_types {
ZeroDayPatch, PatchAutomation
};
public class CliConfig {
#region private members
// Meta-data information
private config_types _type;
private bool _help;
// Common config items
private DateTime _Released_After;
private DateTime _Released_Before;
private bool _Patch_All_Vendors;
private string _Severity;
private bool _Dry_Run;
private bool _Test_Run;
private bool _Print_Version;
private bool _CreateDuplicates;
private string _Vendor_Name;
private string _custom_sp;
private bool _ExcludeOnFail;
private bool _RecreateMissingPolicies;
// ZeroDayPatch config items
private List<string> _Target_Guids;
private bool _Vulnerable;
private bool _debug;
private bool _Retarget;
// Patch Automation config items
private string _locale;
private string _target_test;
private string _target_validation;
private string _target_production;
private int _span_t2v;
private int _span_v2p;
#endregion
public CliConfig(config_types type) {
_Patch_All_Vendors = false;
_Severity = "critical";
_Dry_Run = false;
_Test_Run = false;
_locale = "EN";
_CreateDuplicates = false;
_ExcludeOnFail = false;
_RecreateMissingPolicies = false;
_type = type;
if (_type == config_types.ZeroDayPatch) {
_Target_Guids = new List<string>();
_Vulnerable = false;
_debug = false;
_Retarget = false;
}
if (_type == config_types.PatchAutomation) {
_span_t2v = 2;
_span_v2p = 12;
}
}
#region Public accessors
// Meta-data information
public config_types type {
get {
return _type;
}
}
public bool Help_Needed {
get {
return _help;
}
set {
_help = value;
}
}
// Common config items public accessors
public DateTime Released_After {
get {
return _Released_After;
}
set {
_Released_After = value;
}
}
public DateTime Released_Before {
get {
return _Released_Before;
}
set {
_Released_Before = value;
}
}
public bool Patch_All_Vendors {
get {
return _Patch_All_Vendors;
}
set {
_Patch_All_Vendors = value;
}
}
public string Severity {
get {
return _Severity;
}
set {
_Severity = value;
}
}
public bool Dry_Run {
get {
return _Dry_Run;
}
set {
_Dry_Run = value;
}
}
public bool Debug {
get {
return _debug;
}
set {
_debug = value;
}
}
public bool Test_Run {
get {
return _Test_Run;
}
set {
_Test_Run = value;
}
}
public bool Print_Version {
get {
return _Print_Version;
}
set {
_Print_Version = value;
}
}
public string Vendor_Name {
get {
return _Vendor_Name;
}
set {
_Vendor_Name = value;
}
}
public string Custom_Procedure {
get {
return _custom_sp;
}
set {
_custom_sp = value;
}
}
public bool Create_Duplicates {
get {
return _CreateDuplicates;
}
set {
_CreateDuplicates = value;
}
}
public bool ExcludeOnFail {
get {
return _ExcludeOnFail;
}
set {
_ExcludeOnFail = value;
}
}
public bool RecreateMissingPolicies {
get {
return _RecreateMissingPolicies;
}
set {
_RecreateMissingPolicies = value;
}
}
// ZeroDayPatch config items public accessors
public List<string> Target_Guids {
get {
return _Target_Guids;
}
}
public void Add_TargetGuid(string targetguid) {
_Target_Guids.Add(targetguid);
}
public void Reset_TargetGuids() {
_Target_Guids.Clear();
}
public string Get_TargetGuids() {
string targets = "";
foreach(string target in _Target_Guids) {
targets += target + ";";
}
return targets;
}
public bool Vulnerable {
get {
return _Vulnerable;
}
set {
_Vulnerable = value;
}
}
public bool Retarget {
set {
_Retarget = value;
}
get {
return _Retarget;
}
}
// Patch Automation config items public accessors
public string locale {
get {
return _locale;
}
set {
_locale = value;
}
}
public string Target_Guid_Test {
set {
_target_test = value;
}
get {
return _target_test;
}
}
public string Target_Guid_Validation {
get {
return _target_validation;
}
set {
_target_validation = value;
}
}
public string Target_Guid_Production {
get {
return _target_production;
}
set {
_target_production = value;
}
}
public int Span_Test_To_Validation {
get {
return _span_t2v;
}
set {
_span_t2v = value;
}
}
public int Span_Validation_To_Production {
get {
return _span_v2p;
}
set {
_span_v2p = value;
}
}
public string POLICY_TEST {
get {
if (locale == "FR")
return "Cible de Test";
else
return "Test Target";
}
}
public string POLICY_VALIDATED {
get {
if (locale == "FR")
return "Cible de Validation";
else
return "Validation Target";
}
}
public string POLICY_PRODUCTION {
get {
if (locale == "FR")
return "Cible de Production";
else
return "Production Target";
}
}
#endregion
}
}