Expand description
Match STIX 2.1 patterns against observed STIX objects.
§Example
use stix_matcher::match_scos;
use stix_pattern::parse;
use stix_model::StixObject;
let pattern = parse("[ipv4-addr:value = '198.51.100.1']").unwrap();
let sco = StixObject::from_json(serde_json::json!({
"type": "ipv4-addr", "id": "ipv4-addr--1", "value": "198.51.100.1"
})).unwrap();
let result = match_scos(&pattern, &[sco]).unwrap();
assert!(result.is_match());Re-exports§
pub use error::MatchError;pub use observation::Observation;pub use result::MatchResult;
Modules§
- compare
- Scalar comparison between a resolved
StixValueand a patternLiteral. - error
- Error type for the matcher.
- eval
- Evaluation: leaf comparisons, comparison expressions, and observation expressions.
- observation
- An observation: a set of cyber-observable objects plus temporal metadata.
- pattern_
ops - The
LIKE(SQL wildcard) andMATCHES(regex) operators. - resolve
- Resolve a pattern
ObjectPathto the set of values it selects on an object. - result
- The outcome of a match.
- subset
ISSUBSET/ISSUPERSETfor IPv4/IPv6 addresses and CIDR ranges.
Functions§
- match_
bundle - Match a pattern against a whole bundle, deriving observations from its
observed-dataSDOs and resolving references through the bundle’s objects. - match_
observations - Match a pattern against a list of pre-built observations.
- match_
observed_ data - Match a pattern against
observed-dataSDOs, resolving theirobject_refsthroughstore(MITRE-compatible entry point). - match_
scos - Match a pattern against a flat list of cyber-observable objects, treated as a single observation.