Skip to content
This repository was archived by the owner on Dec 11, 2023. It is now read-only.

Commit 7a44281

Browse files
committed
Added techniques_from_data_src.py script. Simple script for listing
all techniques in ATT&CK that reference a specific data source.
1 parent c37b0ba commit 7a44281

2 files changed

Lines changed: 41 additions & 1 deletion

File tree

CHANGELOG.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
# V1.1 - 29 March 2019
2+
## New Scripts
3+
- Added [techniques_from_data_src.py](scripts/techniques_from_data_src.py).
4+
15
# V1.0 - 1 March 2019
26
## New Scripts
3-
- Added [techniques_data_sources_vis.py](scripts/techniques_data_sources_vis.py).
7+
- Added [techniques_data_sources_vis.py](scripts/techniques_data_sources_vis.py).
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
from stix2 import TAXIICollectionSource, Filter
2+
from taxii2client import Collection
3+
4+
# Create variable to hold all data sources
5+
all_data_srcs = []
6+
7+
# Establish TAXII2 Collection instance for Enterprise ATT&CK collection
8+
collection = Collection("https://cti-taxii.mitre.org/stix/collections/95ecc380-afe9-11e4-9b6c-751b66dd541e/")
9+
10+
# Supply the collection to TAXIICollection
11+
tc_src = TAXIICollectionSource(collection)
12+
13+
# Get all techniques in Enterprise ATT&CK
14+
techniques = tc_src.query([Filter("type", "=", "attack-pattern")])
15+
16+
# Get all data sources in Enterprise ATT&CK
17+
for tech in techniques:
18+
if 'x_mitre_data_sources' in tech:
19+
all_data_srcs += [
20+
data_src for data_src in tech.x_mitre_data_sources
21+
if data_src not in all_data_srcs
22+
]
23+
print("All data sources in Enterprise ATT&CK:\n")
24+
print("\n".join(all_data_srcs) + "\n\n")
25+
26+
# Get all techniques that have Windows Registry as a data source
27+
techs_with_data_src = tc_src.query([
28+
Filter("type", "=", "attack-pattern"),
29+
Filter("x_mitre_data_sources", "in", "Windows Registry")
30+
])
31+
32+
# Get names of techniques
33+
tech_names = [tech.name for tech in techs_with_data_src]
34+
print("The following " + str(len(tech_names)) +
35+
" techniques use 'Windows Registry' as a data source:\n")
36+
print("\n".join(tech_names))

0 commit comments

Comments
 (0)