forked from p15670423/monkey
Improved stix2 core import statement
This commit is contained in:
parent
a55812edbe
commit
90e655d242
|
@ -1,7 +1,6 @@
|
||||||
from typing import List, Dict
|
from typing import List, Dict
|
||||||
|
|
||||||
from stix2 import FileSystemSource, Filter, CourseOfAction, AttackPattern
|
from stix2 import FileSystemSource, Filter, CourseOfAction, AttackPattern, core
|
||||||
from stix2.core import STIXDomainObject
|
|
||||||
|
|
||||||
|
|
||||||
class MitreApiInterface:
|
class MitreApiInterface:
|
||||||
|
@ -33,14 +32,14 @@ class MitreApiInterface:
|
||||||
return all_techniques
|
return all_techniques
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def get_stix2_external_reference_id(stix2_data: STIXDomainObject) -> str:
|
def get_stix2_external_reference_id(stix2_data: core.STIXDomainObject) -> str:
|
||||||
for reference in stix2_data['external_references']:
|
for reference in stix2_data['external_references']:
|
||||||
if reference['source_name'] == "mitre-attack" and 'external_id' in reference:
|
if reference['source_name'] == "mitre-attack" and 'external_id' in reference:
|
||||||
return reference['external_id']
|
return reference['external_id']
|
||||||
return ''
|
return ''
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def get_stix2_external_reference_url(stix2_data: STIXDomainObject) -> str:
|
def get_stix2_external_reference_url(stix2_data: core.STIXDomainObject) -> str:
|
||||||
for reference in stix2_data['external_references']:
|
for reference in stix2_data['external_references']:
|
||||||
if 'url' in reference:
|
if 'url' in reference:
|
||||||
return reference['url']
|
return reference['url']
|
||||||
|
|
Loading…
Reference in New Issue