forked from attwad/nessie
/
resources.go
323 lines (283 loc) · 10 KB
/
resources.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
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
313
314
315
316
317
318
319
320
321
322
323
package nessie
// Editor resources.
// Template is used to create scans or policies with predefined parameters.
type Template struct {
// The uuid for the template.
UUID string `json:"uuid"`
// The short name of the template.
Name string `json:"name"`
// The long name of the template.
Title string `json:"title"`
// The description of the template.
Desc string `json:"description"`
// If true, template is only available on the cloud.
CloudOnly bool `json:"cloud_only"`
// If true, the template is only available for subscribers.
SubscriptionOnly bool `json:"subscription_only"`
// If true, the template is for agent scans.
IsAgent bool `json:"is_agent"`
// An external URL to link the template to.
MoreInfo string `json:"more_info"`
}
type TemplateFormInput struct {
ID string `json:"id"`
Type string `json:"type"`
Label string `json:"label"`
Default string `json:"default"`
Options []string `json:"options"`
}
type TemplateDisplayGroup struct {
Name string `json:"name"`
Title string `json:"title"`
Inputs []string `json:"inputs"`
Sections []string `json:"sections"`
}
type TemplateSection struct {
Name string `json:"name"`
Title string `json:"title"`
Inputs []string `json:"inputs"`
}
type TemplateMode struct {
ID string `json:"id"`
Name string `json:"name"`
Desc string `json:"desc"`
}
type TemplatePluginFamily struct {
ID int64 `json:"id"`
Count int64 `json:"count"`
Status string `json:"status"`
}
type Filter struct {
Name string `json:"name"`
ReadableName string `json:"readable_name"`
Operators []string `json:"operators"`
Controls []FilterControls `json:"controls"`
}
type FilterControls struct {
Type string `json:"type"`
ReadableRegex string `json:"readable_regest"`
Regex string `json:"regex"`
Ooptions []string `json:"options"`
}
// Folders resources.
type Folder struct {
ID int64 `json:"id"`
Name string `json:"name"`
Type string `json:"type"`
DefaultTag int64 `json:"default_tag"`
Custom int64 `json:"custom"`
UnreadCount int64 `json:"unread_count"`
}
// Groups resources.
type Group struct {
ID int64 `json:"id"`
Name string `json:"name"`
Permissions int64 `json:"permissions"`
UserCount int64 `json:"user_count"`
}
// Permissions resources.
type Permission struct {
Owner int64 `json:"owner"`
Type string `json:"type"`
Permissions int64 `json:"permissions"`
ID int64 `json:"id"`
Name string `json:"name"`
}
// Plugins resources.
type PluginAttr struct {
Name string `json:"attribute_name"`
Val string `json:"attribute_value"`
}
type PluginFamily struct {
ID int64 `json:"id"`
Name string `json:"name"`
Count int64 `json:"count"`
}
type PluginFamilies struct {
Families []PluginFamily `json:"families"`
}
type Plugin struct {
ID int64 `json:"id"`
Name string `json:"name"`
}
// Plugin-rules resources.
type Rule struct {
ID int64 `json:"id"`
PluginID int64 `json:"plugin_id"`
Date string `json:"date"`
Host string `json:"host"`
Type string `json:"type"`
Owner string `json:"owner"`
OwnerID int64 `json:"owner_id"`
}
// Policies resources.
type Policy struct {
ID int64 `json:"id"`
TemplateUUID string `json:"template_uuid"`
Name string `json:"name"`
Desc string `json:"description"`
OwnerID int64 `json:"owner_id"`
Owner string `json:"owner"`
Shared int64 `json:"shared"`
UserPerms int64 `json:"user_permissions"`
CreationDate int64 `json:"creation_date"`
LastModificationDate int64 `json:"last_modification_date"`
Visibility string `json:"visibility"`
NoTarget string `json:"no_target"`
}
// Scanners resources.
type Scanner struct {
ID int64 `json:"id"`
UUID string `json:"uuid"`
Name string `json:"name"`
Type string `json:"type"`
Status string `json:"status"`
ScanCount int64 `json:"scan_count"`
EngineVersion string `json:"engine_version"`
Platform string `json:"platform"`
LoadedPluginSet string `json:"loaded_plugin_set"`
RegistrationCode string `json:"registration_code"`
Owner string `json:"owner"`
}
// Scan resource.
type Scan struct {
ID int64 `json:"id"`
UUID string `json:"uuid"`
Name string `json:"name"`
Owner string `json:"owner"`
Shared int `json:"shared"`
UserPermissions int64 `json:"user_permissions"`
CreationDate int64 `json:"creation_date"`
LastModificationDate int64 `json:"last_modification_date"`
StartTime string `json:"starttime"`
TimeZone string `json:"timezone"`
RRules string `json:"rrules"`
ContainerID int `json:"container_id"`
Description string `json:"description"`
PolicyID int `json:"policy_id"`
ScannerID int `json:"scanner_id"`
Emails string `json:"emails"`
AttachReport int `json:"attach_report"`
AttachedReportMaximumSize int `json:"attached_report_maximum_size"`
AttachedReportType interface{} `json:"attached_report_type"`
Sms interface{} `json:"sms"`
Enabled int `json:"enabled"`
UseDashboard int `json:"use_dashboard"`
DashboardFile interface{} `json:"dashboard_file"`
LiveResults int `json:"live_results"`
ScanTimeWindow int `json:"scan_time_window"`
CustomTargets string `json:"custom_targets"`
Migrated int `json:"migrated"`
LastScheduledRun string `json:"last_scheduled_run"`
NotificationFilters interface{} `json:"notification_filters"`
TagID int `json:"tag_id"`
DefaultPermisssions int `json:"default_permisssions"`
OwnerID int `json:"owner_id"`
Type string `json:"type"`
}
type Host struct {
HostID int64 `json:"host_id"`
HostIdx int64 `json:"host_index"`
Hostname string `json:"hostname"`
Progress string `json:"progress"`
Critical int64 `json:"critical"`
High int64 `json:"high"`
Medium int64 `json:"medium"`
Low int64 `json:"low"`
Info int64 `json:"info"`
TotalChecksConsidered int64 `json:"totalchecksconsidered"`
NumChecksConsidered int64 `json:"numchecksconsidered"`
ScanProgressTotal int64 `json:"scanprogresstotal"`
ScanProgressCurrent int64 `json:"scanprogresscurrent"`
Score int64 `json:"score"`
}
// type Note struct {
// Title string `json:"title"`
// Message string `json:"message"`
// Severity int64 `json:"severity"`
// }
type Remediation struct {
Value string `json:"value"`
Remediation string `json:"remediation"`
NumHosts int64 `json:"hosts"`
NumVulns string `json:"vulns"`
}
type History struct {
HistoryID int64 `json:"history_id"`
UUID string `json:"uuid"`
OwnerID int64 `json:"owner_id"`
Status string `json:"status"`
CreationDate int64 `json:"creation_date"`
LastModificationDate int64 `json:"last_modification_date"`
}
type Vulnerability struct {
PluginID int64 `json:"plugin_id"`
PluginName string `json:"plugin_name"`
PluginFamily string `json:"plugin_family"`
Count int64 `json:"count"`
VulnIdx int64 `json:"vuln_index"`
SeverityIdx int64 `json:"severity_index"`
}
type HostVulnerability struct {
HostID int64 `json:"host_id"`
Hostname string `json:"hostname"`
PluginID int64 `json:"plugin_id"`
PluginName string `json:"plugin_name"`
PluginFamily string `json:"plugin_family"`
Count int64 `json:"count"`
VulnIdx int64 `json:"vuln_index"`
SeverityIdx int64 `json:"severity_index"`
Severity int64 `json:"severity"`
}
type HostCompliance struct {
HostID int64 `json:"host_id"`
Hostname string `json:"hostname"`
PluginID int64 `json:"plugin_id"`
PluginName string `json:"plugin_name"`
PluginFamily string `json:"plugin_family"`
Count int64 `json:"count"`
SeverityIdx int64 `json:"severity_index"`
Severity int64 `json:"severity"`
}
type PluginOutput struct {
PluginOutput string `json:"plugin_output"`
Hosts string `json:"hosts"`
Severity int64 `json:"severity"`
Ports []string `json:"ports"`
}
type TimeZone struct {
Name string `json:"name"`
Val string `json:"value"`
}
// Sessions resources.
type Session struct {
ID int64 `json:"id"`
Username string `json:"username"`
Email string `json:"email"`
Name string `json:"name"`
Type string `json:"type"`
Perms int64 `json:"permissions"`
LastLogin int64 `json:"last_login"`
ContainerID int64 `json:"container_id"`
Groups []string `json:"groups"`
}
type User struct {
ID int `json:"id"`
Username string `json:"username"`
Name string `json:"name"`
Email string `json:"email"`
Permissions int `json:"permissions"`
LastLogin int `json:"lastlogin"`
Type string `json:"type"`
}
// AgentGroup The details of an agent group.
type AgentGroup struct {
ID int64 `json:"id"`
Name string `json:"name"`
OwnerID int64 `json:"owner_id"`
Owner string `json:"owner"`
Shared int `json:"shared"`
UserPerms int64 `json:"user_permissions"`
CreationDate int64 `json:"creation_date"`
LastModificationDate int64 `json:"last_modification_date"`
}