forked from stefanoj3/restuss
-
Notifications
You must be signed in to change notification settings - Fork 2
/
entities.go
178 lines (160 loc) · 5.56 KB
/
entities.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
package restuss
import "time"
// PersistedScan represents a Persisted Scan on Nessus API
type PersistedScan struct {
ID int64 `json:"id"`
UUID string `json:"uuid"`
Name string `json:"name"`
Status string `json:"status"`
CreationDate int64 `json:"creation_date"`
LastModificationDate int64 `json:"last_modification_date"`
Owner string `json:"owner"`
}
// Vulnerability represents a Vulnerability returned by Nessus API
type Vulnerability struct {
VulnerabilityIndex int64 `json:"vuln_index"`
Severity int64 `json:"severity"`
PluginName string `json:"plugin_name"`
Count int64 `json:"count"`
PluginID int64 `json:"plugin_id"`
PluginFamily string `json:"plugin_family"`
}
// ScanDetail represents Details from a Scan returned by Nessus API
type ScanDetail struct {
ID int64
Info Info `json:"info"`
Hosts []Host `json:"hosts"`
Vulnerabilities []Vulnerability `json:"vulnerabilities"`
}
// Info represents detailed information from a Scan returned by Nessus API
type Info struct {
Status string `json:"status"`
}
// Host represents a host member of a scan
type Host struct {
ID int64 `json:"host_id"`
Hostname string `json:"hostname"`
}
// ScanSettings represents settings for a Scan to be posted to Nessus API
type ScanSettings struct {
Name string `json:"name"`
Enabled bool `json:"enabled"`
Targets string `json:"text_targets"`
PolicyID int64 `json:"policy_id"`
}
// Scan represents a Scan to be posted to Nessus API
type Scan struct {
TemplateUUID string `json:"uuid"`
Settings ScanSettings `json:"settings"`
}
// ScanTemplate represents a Template for a Scan returned by Nessus API
type ScanTemplate struct {
UUID string `json:"uuid"`
Name string `json:"name"`
Title string `json:"title"`
Description string `json:"description"`
CloudOnly bool `json:"cloud_only"`
SubscriptionOnly bool `json:"subscription_only"`
IsAgent bool `json:"is_agent"`
Info string `json:"more_info"`
}
// PluginAttribute represents an attribute for a plugin returned by Nessus API
type PluginAttribute struct {
Name string `json:"attribute_name"`
Value string `json:"attribute_value"`
}
// Plugin represents a plugin returned by Nessus API
type Plugin struct {
ID int64 `json:"id"`
Name string `json:"name"`
FamilyName string `json:"family_name"`
Attributes []PluginAttribute `json:"attributes"`
}
// PluginOutputResponse represents the output of a plugin returned by Nessus API
type PluginOutputResponse struct {
Output []PluginOutput `json:"outputs"`
}
// PluginOutput represents the output of a plugin returned by Nessus API
type PluginOutput struct {
Hosts string `json:"hosts"`
Ports interface{} `json:"ports"`
Output string `json:"plugin_output"`
Severity int `json:"severity"`
}
// Policy represents a policy returned by Nessus API
type Policy struct {
ID int64
UUID string `json:"uuid"`
Settings PolicySettings `json:"settings"`
}
// PolicySettings represents a setting for policy returned by Nessus API
type PolicySettings struct {
Name string `json:"name"`
}
// Asset represents the asset entity on Tenable.io.
//
// More attributes available at
// https://developer.tenable.com/docs/common-asset-attributes.
type Asset struct {
ID string `json:"id"`
Name string `json:"name"`
Types []string `json:"types"`
Sources []string `json:"sources"`
Created time.Time `json:"created"`
ObservationSources []struct {
FirstObserved time.Time `json:"first_observed"`
LastObserved time.Time `json:"last_observed"`
Name string `json:"name"`
} `json:"observation_sources"`
IsLicensed bool `json:"is_licensed"`
Fqdns []string `json:"fqdns"`
Tags []struct {
ID string `json:"id"`
Category string `json:"category"`
Value string `json:"value"`
Type string `json:"type"`
} `json:"tags"`
Network struct {
ID string `json:"id"`
Name string `json:"name"`
} `json:"network"`
FirstObserved time.Time `json:"first_observed"`
DisplayFqdn string `json:"display_fqdn"`
IsDeleted bool `json:"is_deleted"`
LastObserved time.Time `json:"last_observed"`
Updated time.Time `json:"updated"`
}
// Finding represents the finding entity on Tenable.io.
//
// More info available at
// https://developer.tenable.com/docs/tenable-plugin-attributes.
type Finding struct {
Output string `json:"output"`
ID string `json:"id"`
Severity int `json:"severity"`
Port int `json:"port"`
Protocol string `json:"protocol"`
Service string `json:"service"`
Definition struct {
ID int `json:"id"` // plugin_id
Name string `json:"name"`
Description string `json:"description"`
Synopsis string `json:"synopsis"`
Solution string `json"solution"`
CVSS3 struct {
BaseScore *float32 `json:"base_score"`
} `json:"cvss3"`
CVSS2 struct {
BaseScore *float32 `json:"base_score"`
} `json:"cvss2"`
CWE []string `json:"cwe"`
SeeAlso []string `json:"see_also"`
} `json:"definition"`
}
// Pagination is used to iterate results for some endpoints. If the attribute
// `Next` has content, needs to be passed as a parameter to the next request.
type Pagination struct {
Next string `json:"next"`
Limit int `json:"limit"`
Total int `json:"total"`
}