Skip to content

Commit 9637367

Browse files
Merge pull request #15 from mitre-attack/local-cti-fix
Local CTI patch
2 parents 53dd269 + 92972f4 commit 9637367

File tree

3 files changed

+10
-4
lines changed

3 files changed

+10
-4
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
# v1.2.1 - 16 June 2021
2+
This bug fix patches the ability to use the library with local data sources
3+
## Fixes
4+
- Addressed issue with matrixGen initialization failing for local data sources
5+
16
# v1.2.0 - 2 June 2021
27
This update adds some convenience features to make it easier to create layers programmatically, as well
38
as documentation on how to do so.

mitreattack/navlayers/exporters/matrix_gen.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -102,25 +102,26 @@ def __init__(self, source='taxii', local=None):
102102
:param local: string path to local cache of stix data
103103
"""
104104
self.convert_data = {}
105+
self.collections = dict()
105106
if source.lower() not in ['taxii', 'local']:
106107
print('[MatrixGen] - Unable to generate matrix, source {} is not one of "taxii" or "local"'.format(source))
107108
raise ValueError
108109

109110
if source.lower() == 'taxii':
110111
self.server = Server('https://cti-taxii.mitre.org/taxii')
111112
self.api_root = self.server.api_roots[0]
112-
self.collections = dict()
113113
for collection in self.api_root.collections:
114114
if collection.title != "PRE-ATT&CK":
115115
tc = Collection('https://cti-taxii.mitre.org/stix/collections/' + collection.id)
116116
self.collections[collection.title.split(' ')[0].lower()] = TAXIICollectionSource(tc)
117117
elif source.lower() == 'local':
118118
if local is not None:
119119
hd = MemoryStore()
120+
hd.load_from_file(local)
120121
if 'mobile' in local.lower():
121-
self.collections['mobile'] = hd.load_from_file(local)
122+
self.collections['mobile'] = hd
122123
else:
123-
self.collections['enterprise'] = hd.load_from_file(local)
124+
self.collections['enterprise'] = hd
124125
else:
125126
print('[MatrixGen] - "local" source specified, but path to local source not provided')
126127
raise ValueError

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
setuptools.setup(
77
name="mitreattack-python",
8-
version="1.2.0",
8+
version="1.2.1",
99
author="MITRE ATT&CK, MITRE Corporation",
1010
author_email="attack@mitre.org",
1111
description="MITRE ATT&CK python library",

0 commit comments

Comments
 (0)