swagger/scan/
mod.rs

1use super::*;
2mod checks;
3pub use checks::*;
4pub mod passive;
5pub use passive::*;
6pub mod active;
7pub use active::*;
8mod macros;
9mod print;
10//use colored::*;
11pub use print::*;
12
13#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq, PartialOrd, Ord)]
14pub enum Level {
15    Info,
16    Low,
17    Medium,
18    High,
19    Critical,
20}
21impl Default for Level {
22    fn default() -> Self {
23        Self::Info
24    }
25}
26#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq, PartialOrd, Ord)]
27pub enum Certainty {
28    Passive,
29    Low,
30    Medium,
31    High,
32    Certain,
33}
34impl Default for Certainty {
35    fn default() -> Self {
36        Self::Passive
37    }
38}
39#[derive(Debug, Clone, Serialize, Deserialize, Default, PartialEq, Eq)]
40pub struct Alert {
41    pub level: Level,
42    pub description: String,
43    pub location: String,
44    pub certainty: Certainty,
45}
46impl Alert {
47    pub fn new(level: Level, description: &'static str, location: String) -> Alert {
48        Alert {
49            level,
50            description: description.to_string(),
51            location,
52            certainty: Certainty::Passive,
53        }
54    }
55    pub fn with_certainty(
56        level: Level,
57        description: String,
58        location: String,
59        certainty: Certainty,
60    ) -> Alert {
61        Alert {
62            level,
63            description,
64            location,
65            certainty,
66        }
67    }
68}