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
use super::*;
mod checks;
pub use checks::*;
pub mod passive;
pub use passive::*;
pub mod active;
pub use active::*;
mod macros;
mod print;
pub use print::*;
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq, PartialOrd, Ord)]
pub enum Level {
Info,
Low,
Medium,
High,
Critical,
}
impl Default for Level {
fn default() -> Self {
Self::Info
}
}
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq, PartialOrd, Ord)]
pub enum Certainty {
Passive,
Low,
Medium,
High,
Certain,
}
impl Default for Certainty {
fn default() -> Self {
Self::Passive
}
}
#[derive(Debug, Clone, Serialize, Deserialize, Default, PartialEq, Eq)]
pub struct Alert {
pub level: Level,
pub description: String,
pub location: String,
pub certainty: Certainty,
}
impl Alert {
pub fn new(level: Level, description: &'static str, location: String) -> Alert {
Alert {
level,
description: description.to_string(),
location,
certainty: Certainty::Passive,
}
}
pub fn with_certainty(
level: Level,
description: String,
location: String,
certainty: Certainty,
) -> Alert {
Alert {
level,
description,
location,
certainty,
}
}
}