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
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
/// Identity ypes
#[derive(Clone, PartialEq, ::prost::Message)]
#[derive(Eq, serde_derive::Serialize, serde_derive::Deserialize)]
pub struct Session {
    /// Such as the pid + assetid
    #[prost(string, repeated, tag="1")]
    pub primary_key_properties: ::std::vec::Vec<std::string::String>,
    #[prost(bool, tag="2")]
    pub primary_key_requires_asset_id: bool,
    #[prost(uint64, tag="3")]
    pub created_time: u64,
    #[prost(uint64, tag="4")]
    pub last_seen_time: u64,
    #[prost(uint64, tag="5")]
    pub terminated_time: u64,
}
#[derive(Clone, PartialEq, ::prost::Message)]
#[derive(Eq, serde_derive::Serialize, serde_derive::Deserialize)]
pub struct Static {
    #[prost(string, repeated, tag="1")]
    pub primary_key_properties: ::std::vec::Vec<std::string::String>,
    #[prost(bool, tag="2")]
    pub primary_key_requires_asset_id: bool,
}
#[derive(Clone, PartialEq, ::prost::Message)]
#[derive(Eq, serde_derive::Serialize, serde_derive::Deserialize)]
pub struct IdStrategy {
    #[prost(oneof="id_strategy::Strategy", tags="1, 2")]
    pub strategy: ::std::option::Option<id_strategy::Strategy>,
}
pub mod id_strategy {
    #[derive(Clone, PartialEq, ::prost::Oneof)]
    #[derive(Eq, serde_derive::Serialize, serde_derive::Deserialize)]
    pub enum Strategy {
        #[prost(message, tag="1")]
        Session(super::Session),
        #[prost(message, tag="2")]
        Static(super::Static),
    }
}
/// Used to identify the system for a given node
/// for example, 'a process executed on cobrien-mbp'
#[derive(Clone, PartialEq, ::prost::Message)]
#[derive(Eq, serde_derive::Serialize, serde_derive::Deserialize)]
pub struct Host {
    #[prost(oneof="host::HostId", tags="1, 2")]
    pub host_id: ::std::option::Option<host::HostId>,
}
pub mod host {
    #[derive(Clone, PartialEq, ::prost::Oneof)]
    #[derive(Eq, serde_derive::Serialize, serde_derive::Deserialize)]
    pub enum HostId {
        /// the hostname of the host
        #[prost(string, tag="1")]
        Hostname(std::string::String),
        /// The asset ID itself
        /// We expect this to be the variant once we have attributed the node
        #[prost(string, tag="2")]
        AssetId(std::string::String),
    }
}
#[derive(Clone, PartialEq, ::prost::Message)]
#[derive(Eq, serde_derive::Serialize, serde_derive::Deserialize)]
pub struct Node {
    #[prost(oneof="node::WhichNode", tags="1, 2, 3, 4, 5, 6, 7, 8, 9, 10")]
    pub which_node: ::std::option::Option<node::WhichNode>,
}
pub mod node {
    #[derive(Clone, PartialEq, ::prost::Oneof)]
    #[derive(Eq, serde_derive::Serialize, serde_derive::Deserialize)]
    pub enum WhichNode {
        #[prost(message, tag="1")]
        AssetNode(super::Asset),
        #[prost(message, tag="2")]
        ProcessNode(super::Process),
        #[prost(message, tag="3")]
        FileNode(super::File),
        #[prost(message, tag="4")]
        IpAddressNode(super::IpAddress),
        #[prost(message, tag="5")]
        ProcessOutboundConnectionNode(super::ProcessOutboundConnection),
        #[prost(message, tag="6")]
        ProcessInboundConnectionNode(super::ProcessInboundConnection),
        #[prost(message, tag="7")]
        IpPortNode(super::IpPort),
        #[prost(message, tag="8")]
        NetworkConnectionNode(super::NetworkConnection),
        #[prost(message, tag="9")]
        IpConnectionNode(super::IpConnection),
        #[prost(message, tag="10")]
        DynamicNode(super::DynamicNode),
    }
}
#[derive(Clone, PartialEq, ::prost::Message)]
#[derive(Eq, serde_derive::Serialize, serde_derive::Deserialize)]
#[derive(Builder)]
#[builder(setter(into))]
pub struct Asset {
    #[prost(string, tag="1")]
    #[builder(field(private))]
    #[builder(default = "::uuid::Uuid::new_v4().to_string()")]
    pub node_key: std::string::String,
    #[prost(message, optional, tag="2")]
    #[builder(default)]
    pub asset_id: ::std::option::Option<::std::string::String>,
    #[prost(message, optional, tag="3")]
    #[builder(default)]
    pub hostname: ::std::option::Option<::std::string::String>,
    #[prost(message, optional, tag="4")]
    #[builder(default)]
    pub mac_address: ::std::option::Option<::std::string::String>,
    #[prost(uint64, tag="5")]
    #[builder(default)]
    pub first_seen_timestamp: u64,
    #[prost(uint64, tag="6")]
    #[builder(default)]
    pub last_seen_timestamp: u64,
}
#[derive(Clone, PartialEq, ::prost::Message)]
#[derive(Eq, serde_derive::Serialize, serde_derive::Deserialize)]
#[derive(Builder)]
#[builder(setter(into))]
pub struct IpConnection {
    #[prost(string, tag="1")]
    #[builder(field(private))]
    #[builder(default = "::uuid::Uuid::new_v4().to_string()")]
    pub node_key: std::string::String,
    #[prost(string, tag="2")]
    pub src_ip_address: std::string::String,
    #[prost(string, tag="3")]
    pub dst_ip_address: std::string::String,
    #[prost(string, tag="4")]
    pub protocol: std::string::String,
    #[prost(uint64, tag="5")]
    #[builder(default)]
    pub created_timestamp: u64,
    #[prost(uint64, tag="6")]
    #[builder(default)]
    pub terminated_timestamp: u64,
    #[prost(uint64, tag="7")]
    #[builder(default)]
    pub last_seen_timestamp: u64,
    #[prost(uint32, tag="8")]
    pub state: u32,
}
#[derive(Clone, PartialEq, ::prost::Message)]
#[derive(Eq, serde_derive::Serialize, serde_derive::Deserialize)]
#[derive(Builder)]
#[builder(setter(into))]
pub struct NetworkConnection {
    #[prost(string, tag="1")]
    #[builder(field(private))]
    #[builder(default = "::uuid::Uuid::new_v4().to_string()")]
    pub node_key: std::string::String,
    #[prost(string, tag="2")]
    pub src_ip_address: std::string::String,
    #[prost(string, tag="3")]
    pub dst_ip_address: std::string::String,
    #[prost(string, tag="4")]
    pub protocol: std::string::String,
    #[prost(uint32, tag="5")]
    pub src_port: u32,
    #[prost(uint32, tag="6")]
    pub dst_port: u32,
    #[prost(uint64, tag="7")]
    #[builder(default)]
    pub created_timestamp: u64,
    #[prost(uint64, tag="8")]
    #[builder(default)]
    pub terminated_timestamp: u64,
    #[prost(uint64, tag="9")]
    #[builder(default)]
    pub last_seen_timestamp: u64,
    #[prost(uint32, tag="10")]
    pub state: u32,
}
#[derive(Clone, PartialEq, ::prost::Message)]
#[derive(Eq, serde_derive::Serialize, serde_derive::Deserialize)]
#[derive(Builder)]
#[builder(setter(into))]
pub struct IpPort {
    #[prost(string, tag="1")]
    #[builder(field(private))]
    #[builder(default = "::uuid::Uuid::new_v4().to_string()")]
    pub node_key: std::string::String,
    #[prost(string, tag="2")]
    pub ip_address: std::string::String,
    #[prost(uint32, tag="3")]
    pub port: u32,
    #[prost(string, tag="4")]
    pub protocol: std::string::String,
}
/// Identity = Session(asset_id + port + ip_address, created_timestamp)
#[derive(Clone, PartialEq, ::prost::Message)]
#[derive(Eq, serde_derive::Serialize, serde_derive::Deserialize)]
#[derive(Builder)]
#[builder(setter(into))]
pub struct ProcessOutboundConnection {
    #[prost(string, tag="1")]
    #[builder(field(private))]
    #[builder(default = "::uuid::Uuid::new_v4().to_string()")]
    pub node_key: std::string::String,
    #[prost(message, optional, tag="2")]
    #[builder(default)]
    pub asset_id: ::std::option::Option<::std::string::String>,
    #[prost(message, optional, tag="3")]
    #[builder(default)]
    pub hostname: ::std::option::Option<::std::string::String>,
    /// 1 = Created, 2 = Terminated, 3 = Existing
    #[prost(uint32, tag="4")]
    pub state: u32,
    #[prost(uint64, tag="5")]
    #[builder(default)]
    pub created_timestamp: u64,
    #[prost(uint64, tag="6")]
    #[builder(default)]
    pub terminated_timestamp: u64,
    #[prost(uint64, tag="7")]
    #[builder(default)]
    pub last_seen_timestamp: u64,
    #[prost(uint32, tag="8")]
    pub port: u32,
    #[prost(string, tag="9")]
    pub ip_address: std::string::String,
    #[prost(string, tag="10")]
    pub protocol: std::string::String,
}
/// Identity = Session(asset_id + port + ip_address, created_timestamp)
#[derive(Clone, PartialEq, ::prost::Message)]
#[derive(Eq, serde_derive::Serialize, serde_derive::Deserialize)]
#[derive(Builder)]
#[builder(setter(into))]
pub struct ProcessInboundConnection {
    #[prost(string, tag="1")]
    #[builder(field(private))]
    #[builder(default = "::uuid::Uuid::new_v4().to_string()")]
    pub node_key: std::string::String,
    #[prost(message, optional, tag="2")]
    #[builder(default)]
    pub asset_id: ::std::option::Option<::std::string::String>,
    #[prost(message, optional, tag="3")]
    #[builder(default)]
    pub hostname: ::std::option::Option<::std::string::String>,
    /// 1 = Created, 2 = Terminated, 3 = Existing
    #[prost(uint32, tag="4")]
    pub state: u32,
    #[prost(uint64, tag="5")]
    #[builder(default)]
    pub created_timestamp: u64,
    #[prost(uint64, tag="6")]
    #[builder(default)]
    pub terminated_timestamp: u64,
    #[prost(uint64, tag="7")]
    #[builder(default)]
    pub last_seen_timestamp: u64,
    #[prost(uint32, tag="8")]
    pub port: u32,
    #[prost(string, tag="9")]
    pub ip_address: std::string::String,
    #[prost(string, tag="10")]
    pub protocol: std::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
#[derive(Eq, serde_derive::Serialize, serde_derive::Deserialize)]
#[derive(Builder)]
#[builder(setter(into))]
pub struct Process {
    #[prost(string, tag="1")]
    #[builder(field(private))]
    #[builder(default = "::uuid::Uuid::new_v4().to_string()")]
    pub node_key: std::string::String,
    #[prost(message, optional, tag="2")]
    #[builder(default)]
    pub asset_id: ::std::option::Option<::std::string::String>,
    #[prost(message, optional, tag="3")]
    #[builder(default)]
    pub hostname: ::std::option::Option<::std::string::String>,
    #[prost(uint32, tag="4")]
    pub state: u32,
    #[prost(uint64, tag="5")]
    #[builder(default)]
    pub process_id: u64,
    #[prost(string, tag="6")]
    #[builder(default)]
    pub process_guid: std::string::String,
    /// When state == 1, create_time
    /// When state == 2, end_time
    /// When state == 3, seen_time
    #[prost(uint64, tag="7")]
    #[builder(default)]
    pub created_timestamp: u64,
    #[prost(uint64, tag="8")]
    #[builder(default)]
    pub terminated_timestamp: u64,
    #[prost(uint64, tag="9")]
    #[builder(default)]
    pub last_seen_timestamp: u64,
    #[prost(string, tag="10")]
    #[builder(default)]
    pub process_name: std::string::String,
    #[prost(string, tag="11")]
    #[builder(default)]
    pub process_command_line: std::string::String,
    #[prost(string, tag="12")]
    #[builder(default)]
    pub operating_system: std::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
#[derive(Eq, serde_derive::Serialize, serde_derive::Deserialize)]
#[derive(Builder)]
#[builder(setter(into))]
pub struct File {
    #[prost(string, tag="1")]
    #[builder(field(private))]
    #[builder(default = "::uuid::Uuid::new_v4().to_string()")]
    pub node_key: std::string::String,
    #[prost(message, optional, tag="2")]
    #[builder(default)]
    pub asset_id: ::std::option::Option<::std::string::String>,
    #[prost(message, optional, tag="3")]
    #[builder(default)]
    pub hostname: ::std::option::Option<::std::string::String>,
    /// 1 = Created, 2 = Deleted, 3 = Referenced
    #[prost(uint32, tag="4")]
    pub state: u32,
    #[prost(uint64, tag="5")]
    #[builder(default)]
    pub created_timestamp: u64,
    #[prost(uint64, tag="6")]
    #[builder(default)]
    pub deleted_timestamp: u64,
    #[prost(uint64, tag="7")]
    #[builder(default)]
    pub last_seen_timestamp: u64,
    #[prost(string, tag="8")]
    #[builder(default)]
    pub file_name: std::string::String,
    #[prost(string, tag="9")]
    #[builder(default)]
    pub file_path: std::string::String,
    #[prost(string, tag="10")]
    #[builder(default)]
    pub file_extension: std::string::String,
    #[prost(string, tag="11")]
    #[builder(default)]
    pub file_mime_type: std::string::String,
    #[prost(uint64, tag="12")]
    #[builder(default)]
    pub file_size: u64,
    #[prost(string, tag="13")]
    #[builder(default)]
    pub file_version: std::string::String,
    #[prost(string, tag="14")]
    #[builder(default)]
    pub file_description: std::string::String,
    #[prost(string, tag="15")]
    #[builder(default)]
    pub file_product: std::string::String,
    #[prost(string, tag="16")]
    #[builder(default)]
    pub file_company: std::string::String,
    #[prost(string, tag="17")]
    #[builder(default)]
    pub file_directory: std::string::String,
    #[prost(uint64, tag="18")]
    #[builder(default)]
    pub file_inode: u64,
    #[prost(uint64, tag="19")]
    #[builder(default)]
    pub file_hard_links: u64,
    #[prost(string, tag="20")]
    #[builder(default)]
    pub md5_hash: std::string::String,
    #[prost(string, tag="21")]
    #[builder(default)]
    pub sha1_hash: std::string::String,
    #[prost(string, tag="22")]
    #[builder(default)]
    pub sha256_hash: std::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
#[derive(Eq, serde_derive::Serialize, serde_derive::Deserialize)]
#[derive(Builder)]
#[builder(setter(into))]
pub struct IpAddress {
    #[prost(string, tag="1")]
    #[builder(field(private))]
    #[builder(default = "::uuid::Uuid::new_v4().to_string()")]
    pub node_key: std::string::String,
    #[prost(string, tag="2")]
    pub ip_address: std::string::String,
    #[prost(uint64, tag="3")]
    #[builder(default)]
    pub first_seen_timestamp: u64,
    #[prost(uint64, tag="4")]
    #[builder(default)]
    pub last_seen_timestamp: u64,
}
#[derive(Clone, PartialEq, ::prost::Message)]
#[derive(Eq, serde_derive::Serialize, serde_derive::Deserialize)]
pub struct NodeProperty {
    #[prost(oneof="node_property::Property", tags="1, 2, 3")]
    pub property: ::std::option::Option<node_property::Property>,
}
pub mod node_property {
    #[derive(Clone, PartialEq, ::prost::Oneof)]
    #[derive(Eq, serde_derive::Serialize, serde_derive::Deserialize)]
    pub enum Property {
        #[prost(int64, tag="1")]
        Intprop(i64),
        #[prost(uint64, tag="2")]
        Uintprop(u64),
        #[prost(string, tag="3")]
        Strprop(std::string::String),
    }
}
#[derive(Clone, PartialEq, ::prost::Message)]
#[derive(Eq, serde_derive::Serialize, serde_derive::Deserialize)]
pub struct DynamicNode {
    #[prost(map="string, message", tag="1")]
    pub properties: ::std::collections::HashMap<std::string::String, NodeProperty>,
    #[prost(string, tag="2")]
    pub node_key: std::string::String,
    #[prost(string, tag="3")]
    pub node_type: std::string::String,
    #[prost(uint64, tag="4")]
    pub seen_at: u64,
    #[prost(message, optional, tag="5")]
    pub asset_id: ::std::option::Option<::std::string::String>,
    #[prost(message, optional, tag="6")]
    pub hostname: ::std::option::Option<::std::string::String>,
    #[prost(message, optional, tag="7")]
    pub host_ip: ::std::option::Option<::std::string::String>,
    #[prost(message, repeated, tag="8")]
    pub id_strategy: ::std::vec::Vec<IdStrategy>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
#[derive(Eq, serde_derive::Serialize, serde_derive::Deserialize)]
pub struct Edge {
    #[prost(string, tag="1")]
    pub from: std::string::String,
    #[prost(string, tag="2")]
    pub to: std::string::String,
    #[prost(string, tag="3")]
    pub edge_name: std::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
#[derive(Eq, serde_derive::Serialize, serde_derive::Deserialize)]
pub struct EdgeList {
    #[prost(message, repeated, tag="1")]
    pub edges: ::std::vec::Vec<Edge>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
#[derive(Eq, serde_derive::Serialize, serde_derive::Deserialize)]
pub struct Graph {
    #[prost(map="string, message", tag="1")]
    pub nodes: ::std::collections::HashMap<std::string::String, Node>,
    #[prost(map="string, message", tag="2")]
    pub edges: ::std::collections::HashMap<std::string::String, EdgeList>,
    #[prost(uint64, tag="3")]
    pub timestamp: u64,
}
#[derive(Clone, PartialEq, ::prost::Message)]
#[derive(Eq, serde_derive::Serialize, serde_derive::Deserialize)]
pub struct GeneratedSubgraphs {
    #[prost(message, repeated, tag="1")]
    pub subgraphs: ::std::vec::Vec<Graph>,
}