1
1
package indexer
2
2
3
+ import (
4
+ "time"
5
+ )
6
+
7
+ // Helper functions for non-string primitives
8
+ func BoolPtr (b bool ) * bool { return & b }
9
+ func Int64Ptr (i int64 ) * int64 { return & i }
10
+ func Float64Ptr (f float64 ) * float64 { return & f }
11
+ func TimePtr (t time.Time ) * time.Time { return & t }
12
+
3
13
type Build struct {
4
- Original string `json:"original"`
14
+ Original string `json:"original,omitempty "`
5
15
}
6
16
7
- type Agent struct {
8
- Build Build `json:"build,omitempty"`
9
- EphemeralID string `json:"ephemeral_id,omitempty"`
10
- ID string `json:"id"`
11
- Name string `json:"name"`
12
- Type string `json:"type"`
13
- Version string `json:"version"`
17
+ type AgentHostBoot struct {
18
+ ID string `json:"id,omitempty"`
19
+ }
20
+
21
+ type AgentHostCPU struct {
22
+ Usage * float64 `json:"usage,omitempty"`
23
+ }
24
+
25
+ type DiskIO struct {
26
+ Bytes * int64 `json:"bytes,omitempty"`
27
+ }
28
+
29
+ type AgentHostDisk struct {
30
+ Read * DiskIO `json:"read,omitempty"`
31
+ Write * DiskIO `json:"write,omitempty"`
14
32
}
15
33
16
34
type OS struct {
@@ -27,66 +45,144 @@ type Host struct {
27
45
OS OS `json:"os"`
28
46
}
29
47
48
+ type Geo struct {
49
+ CityName string `json:"city_name,omitempty"`
50
+ ContinentCode string `json:"continent_code,omitempty"`
51
+ ContinentName string `json:"continent_name,omitempty"`
52
+ CountryIsoCode string `json:"country_iso_code,omitempty"`
53
+ CountryName string `json:"country_name,omitempty"`
54
+ Location string `json:"location,omitempty"` // geo_point
55
+ Name string `json:"name,omitempty"`
56
+ PostalCode string `json:"postal_code,omitempty"`
57
+ RegionIsoCode string `json:"region_iso_code,omitempty"`
58
+ RegionName string `json:"region_name,omitempty"`
59
+ Timezone string `json:"timezone,omitempty"`
60
+ }
61
+
62
+ type NetworkTraffic struct {
63
+ Bytes * int64 `json:"bytes,omitempty"`
64
+ Packets * int64 `json:"packets,omitempty"`
65
+ }
66
+
67
+ type AgentHostNetwork struct {
68
+ Egress * NetworkTraffic `json:"egress,omitempty"`
69
+ Ingress * NetworkTraffic `json:"ingress,omitempty"`
70
+ }
71
+
72
+ type HostOS struct {
73
+ Family string `json:"family,omitempty"`
74
+ Full string `json:"full,omitempty"`
75
+ Kernel string `json:"kernel,omitempty"`
76
+ Name string `json:"name,omitempty"`
77
+ Platform string `json:"platform,omitempty"`
78
+ Type string `json:"type,omitempty"`
79
+ Version string `json:"version,omitempty"`
80
+ }
81
+
82
+ type RiskScores struct {
83
+ CalculatedLevel string `json:"calculated_level,omitempty"`
84
+ CalculatedScore * float64 `json:"calculated_score,omitempty"`
85
+ CalculatedScoreNorm * float64 `json:"calculated_score_norm,omitempty"`
86
+ StaticLevel string `json:"static_level,omitempty"`
87
+ StaticScore * float64 `json:"static_score,omitempty"`
88
+ StaticScoreNorm * float64 `json:"static_score_norm,omitempty"`
89
+ }
90
+
91
+ type AgentHost struct {
92
+ Architecture string `json:"architecture,omitempty"`
93
+ Boot * AgentHostBoot `json:"boot,omitempty"`
94
+ CPU * AgentHostCPU `json:"cpu,omitempty"`
95
+ Disk * AgentHostDisk `json:"disk,omitempty"`
96
+ Domain string `json:"domain,omitempty"`
97
+ Geo * Geo `json:"geo,omitempty"`
98
+ Hostname string `json:"hostname,omitempty"`
99
+ ID string `json:"id,omitempty"`
100
+ IP string `json:"ip,omitempty"`
101
+ MAC string `json:"mac,omitempty"`
102
+ Name string `json:"name,omitempty"`
103
+ Network * AgentHostNetwork `json:"network,omitempty"`
104
+ OS * HostOS `json:"os,omitempty"`
105
+ PidNSIno string `json:"pid_ns_ino,omitempty"`
106
+ Risk * RiskScores `json:"risk,omitempty"`
107
+ Type string `json:"type,omitempty"`
108
+ Uptime * int64 `json:"uptime,omitempty"`
109
+ }
110
+
111
+ type Agent struct {
112
+ Build * Build `json:"build,omitempty"`
113
+ EphemeralID string `json:"ephemeral_id,omitempty"`
114
+ Groups []string `json:"groups,omitempty"`
115
+ Host * AgentHost `json:"host,omitempty"`
116
+ ID string `json:"id,omitempty"`
117
+ Name string `json:"name,omitempty"`
118
+ Type string `json:"type,omitempty"`
119
+ Version string `json:"version,omitempty"`
120
+ }
121
+
30
122
type Package struct {
31
- Architecture string `json:"architecture"`
32
- BuildVersion string `json:"build_version,omitempty"`
33
- Checksum string `json:"checksum,omitempty"`
34
- Description string `json:"description"`
35
- InstallScope string `json:"install_scope,omitempty"`
36
- Installed string `json:"installed,omitempty"` // assuming installed date is a string in ISO format
37
- License string `json:"license,omitempty"`
38
- Name string `json:"name"`
39
- Path string `json:"path,omitempty"`
40
- Reference string `json:"reference,omitempty"`
41
- Size int64 `json:"size"`
42
- Type string `json:"type"`
43
- Version string `json:"version"`
123
+ Architecture string `json:"architecture,omitempty "`
124
+ BuildVersion string `json:"build_version,omitempty"`
125
+ Checksum string `json:"checksum,omitempty"`
126
+ Description string `json:"description,omitempty "`
127
+ InstallScope string `json:"install_scope,omitempty"`
128
+ Installed * time. Time `json:"installed,omitempty"`
129
+ License string `json:"license,omitempty"`
130
+ Name string `json:"name,omitempty "`
131
+ Path string `json:"path,omitempty"`
132
+ Reference string `json:"reference,omitempty"`
133
+ Size * int64 `json:"size,omitempty "`
134
+ Type string `json:"type,omitempty "`
135
+ Version string `json:"version,omitempty "`
44
136
}
45
137
46
138
type Scanner struct {
47
- Vendor string `json:"vendor"`
139
+ Condition string `json:"condition,omitempty"`
140
+ Reference string `json:"reference,omitempty"`
141
+ Source string `json:"source,omitempty"`
142
+ Vendor string `json:"vendor,omitempty"`
48
143
}
49
144
50
145
type Score struct {
51
- Base float64 `json:"base"`
52
- Environmental float64 `json:"environmental,omitempty"`
53
- Temporal float64 `json:"temporal,omitempty"`
54
- Version string `json:"version"`
146
+ Base * float64 `json:"base,omitempty "`
147
+ Environmental * float64 `json:"environmental,omitempty"`
148
+ Temporal * float64 `json:"temporal,omitempty"`
149
+ Version string `json:"version,omitempty "`
55
150
}
56
151
57
152
type Vulnerability struct {
58
- Category string `json:"category"`
59
- Classification string `json:"classification"`
60
- Description string `json:"description"`
61
- DetectedAt string `json:"detected_at"` // assuming dates are in string format
62
- Enumeration string `json:"enumeration"`
63
- ID string `json:"id"`
64
- PublishedAt string `json:"published_at"` // assuming dates are in string format
65
- Reference string `json:"reference"`
66
- ReportID string `json:"report_id,omitempty"`
67
- Scanner Scanner `json:"scanner"`
68
- Score Score `json:"score"`
69
- Severity string `json:"severity"`
153
+ Category string `json:"category,omitempty"`
154
+ Classification string `json:"classification,omitempty"`
155
+ Description string `json:"description,omitempty"`
156
+ DetectedAt * time.Time `json:"detected_at,omitempty"`
157
+ Enumeration string `json:"enumeration,omitempty"`
158
+ ID string `json:"id,omitempty"`
159
+ PublishedAt * time.Time `json:"published_at,omitempty"`
160
+ Reference string `json:"reference,omitempty"`
161
+ ReportID string `json:"report_id,omitempty"`
162
+ Scanner * Scanner `json:"scanner,omitempty"`
163
+ Score * Score `json:"score,omitempty"`
164
+ Severity string `json:"severity,omitempty"`
165
+ UnderEvaluation * bool `json:"under_evaluation,omitempty"`
70
166
}
71
167
72
168
type Cluster struct {
73
- Name string `json:"name"`
169
+ Name string `json:"name,omitempty "`
74
170
Node string `json:"node,omitempty"`
75
171
}
76
172
77
173
type Schema struct {
78
- Version string `json:"version"`
174
+ Version string `json:"version,omitempty "`
79
175
}
80
176
81
177
type Wazuh struct {
82
- Cluster Cluster `json:"cluster"`
83
- Schema Schema `json:"schema"`
178
+ Cluster * Cluster `json:"cluster,omitempty "`
179
+ Schema * Schema `json:"schema,omitempty "`
84
180
}
85
181
86
182
type AgentVulnerability struct {
87
- Agent Agent `json:"agent"`
88
- Host Host `json:"host"`
89
- Package Package `json:"package"`
90
- Vulnerability Vulnerability `json:"vulnerability"`
91
- Wazuh Wazuh `json:"wazuh"`
183
+ Agent * Agent `json:"agent,omitempty "`
184
+ Host * Host `json:"host,omitempty "`
185
+ Package * Package `json:"package,omitempty "`
186
+ Vulnerability * Vulnerability `json:"vulnerability,omitempty "`
187
+ Wazuh * Wazuh `json:"wazuh,omitempty "`
92
188
}
0 commit comments