You can query the ATT&CK dataset for specific objects using several identifiers. Using a STIX ID is the preferred method as they are guaranteed to be unique.
By STIX ID
Use the .get() method on your DataStore object with the full STIX ID.
By ATT&CK ID
Use stix2.Filter to query the external_references.external_id field.
Note: When querying for techniques using an ATT&CK ID, you should also filter by type='attack-pattern' to avoid collisions with deprecated mitigations that previously shared technique IDs.
By Name
Filter by type and name using stix2.Filter.
By Alias
Filter by type='intrusion-set' and the aliases field to find specific groups.
# By STIX ID
g0075 = src.get("intrusion-set--f40eb8ce-2a74-4e56-89a1-227021410142")
# By ATT&CK ID (with type safety for techniques)
from stix2 import Filter
t1134 = src.query([
Filter("external_references.external_id", "=", "T1134"),
Filter("type", "=", "attack-pattern")
])[0]
# By name
def get_technique_by_name(thesrc, name):
filt = [
Filter('type', '=', 'attack-pattern'),
Filter('name', '=', name)
]
return thesrc.query(filt)
# By alias
def get_group_by_alias(thesrc, alias):
return thesrc.query([
Filter('type', '=', 'intrusion-set'),
Filter('aliases', '=', alias)
])[0]