attck 0.3.0

Structure representation of MITRE ATT&CK matrices
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
use stix::ExternalReference;

/// Check if an external reference is to MITRE ATT&CK.
pub fn is_mitre_reference(xr: &ExternalReference) -> bool {
    xr.source_name == "mitre-attack"
}

/// Get the MITRE ATT&CK ID from an external reference, if the external reference
/// is of the correct type.
pub fn get_mitre_id(xr: &ExternalReference) -> Option<&str> {
    if is_mitre_reference(xr) {
        xr.external_id.as_ref().map(|s| s.as_str())
    } else {
        None
    }
}