filters

Filters for Python STIX 2.0 DataSources, DataSinks, DataStores

class Filter

STIX 2 filters that support the querying functionality of STIX 2 DataStores and DataSources.

Initialized like a Python tuple.

Parameters:
  • property (str) – filter property name, corresponds to STIX 2 object property
  • op (str) – operator of the filter
  • value (str) – filter property value

Example

Filter(“id”, “=”, “malware–0f862b01-99da-47cc-9bdb-db4a86a95bb1”)

apply_common_filters(stix_objs, query)

Evaluate filters against a set of STIX 2.0 objects.

Supports only STIX 2.0 common property properties.

Parameters:
  • stix_objs (list) – list of STIX objects to apply the query to
  • query (set) – set of filters (combined form complete query)
Yields:

STIX objects that successfully evaluate against the query.

FILTER_OPS = ['=', '!=', 'in', '>', '<', '>=', '<=']

Supported filter value types