Trait scayl::cvss::FromVector
source · [−]pub trait FromVector {
fn from_vector(symbols: &BTreeMap<&str, &str>) -> Option<Self>
where
Self: Sized;
fn from_vector_string(str: &str) -> Option<Self>
where
Self: Sized;
fn cvss_vector(&self) -> String;
}
Expand description
An abstraction for CVSS Metrics
Required Methods
Creates a CVSS metric from a map of symbols.
fn from_vector_string(str: &str) -> Option<Self> where
Self: Sized,
fn from_vector_string(str: &str) -> Option<Self> where
Self: Sized,
Creates a CVSS metric from a cvss standard string.
Example
use scayl::{FromVector, v3_1};
let metric = v3_1::BaseMetric
::from_vector_string("CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H");
fn cvss_vector(&self) -> String
fn cvss_vector(&self) -> String
Creates a CVSS standard string
Example
use scayl::{FromVector, v3_1};
let metric = v3_1::BaseMetric {
attack_vector: v3_1::AttackVector::Network,
attack_complexity: v3_1::AttackComplexity::Low,
privileges_required: v3_1::PrivilegesRequired::None,
user_interaction: v3_1::UserInteraction::None,
scope: v3_1::Scope::Unchanged,
confidentiality_impact: v3_1::ImpactMetric::None,
integrity_impact: v3_1::ImpactMetric::None,
availability_impact: v3_1::ImpactMetric::None
};
let str = metric.cvss_vector();