updatd the Python packages
parent
4b1b7bd5e1
commit
8456033337
|
@ -16,21 +16,9 @@ class ATTACKData():
|
|||
self.mitre = attack_client()
|
||||
self.attack_cti_techniques = self.mitre.get_enterprise_techniques()
|
||||
self.attack_cti_techniques = self.mitre.remove_revoked(self.attack_cti_techniques)
|
||||
self.attack_cti_techniques = self.remove_deprecated(self.attack_cti_techniques)
|
||||
self.attack_cti_techniques = self.mitre.remove_deprecated(self.attack_cti_techniques)
|
||||
self.attack_cti_software = self.mitre.get_software()
|
||||
self.attack_cti_software = self.remove_deprecated(self.attack_cti_software)
|
||||
|
||||
def remove_deprecated(self, stix_objects):
|
||||
"""
|
||||
Remove deprecated STIX objects
|
||||
:param stix_objects: list of STIX objects
|
||||
:return: a list of STIX objects
|
||||
"""
|
||||
handle_deprecated = list()
|
||||
for obj in stix_objects:
|
||||
if not('x_mitre_deprecated' in obj.keys() and obj['x_mitre_deprecated'] == True):
|
||||
handle_deprecated.append(obj)
|
||||
return handle_deprecated
|
||||
self.attack_cti_software = self.mitre.remove_deprecated(self.attack_cti_software)
|
||||
|
||||
def dump_data(self, data, filename):
|
||||
"""
|
||||
|
|
|
@ -1 +1 @@
|
|||
attackcti==0.3.2
|
||||
attackcti==0.3.3
|
27
generic.py
27
generic.py
|
@ -28,19 +28,6 @@ def _save_attack_data(data, path):
|
|||
pickle.dump([data, dt.now()], f)
|
||||
|
||||
|
||||
def remove_deprecated(stix_objects):
|
||||
"""
|
||||
Remove deprecated STIX objects
|
||||
:param stix_objects: list of STIX objects
|
||||
:return: a list of STIX objects
|
||||
"""
|
||||
handle_deprecated = list()
|
||||
for obj in stix_objects:
|
||||
if not('x_mitre_deprecated' in obj.keys() and obj['x_mitre_deprecated'] == True):
|
||||
handle_deprecated.append(obj)
|
||||
return handle_deprecated
|
||||
|
||||
|
||||
def load_attack_data(data_type):
|
||||
"""
|
||||
By default the ATT&CK data is loaded from the online TAXII server or from the local cache directory. The
|
||||
|
@ -74,11 +61,11 @@ def load_attack_data(data_type):
|
|||
if data_type == DATA_TYPE_STIX_ALL_RELATIONSHIPS:
|
||||
attack_data = mitre.get_relationships()
|
||||
attack_data = mitre.remove_revoked(attack_data)
|
||||
attack_data = remove_deprecated(attack_data)
|
||||
attack_data = mitre.remove_deprecated(attack_data)
|
||||
elif data_type == DATA_TYPE_STIX_ALL_TECH_ENTERPRISE:
|
||||
attack_data = mitre.get_enterprise_techniques()
|
||||
attack_data = mitre.remove_revoked(attack_data)
|
||||
attack_data = remove_deprecated(attack_data)
|
||||
attack_data = mitre.remove_deprecated(attack_data)
|
||||
elif data_type == DATA_TYPE_CUSTOM_TECH_BY_GROUP:
|
||||
# First we need to know which technique references (STIX Object type 'attack-pattern') we have for all
|
||||
# groups. This results in a dict: {group_id: Gxxxx, technique_ref/attack-pattern_ref: ...}
|
||||
|
@ -120,15 +107,15 @@ def load_attack_data(data_type):
|
|||
elif data_type == DATA_TYPE_STIX_ALL_TECH:
|
||||
attack_data = mitre.get_techniques()
|
||||
attack_data = mitre.remove_revoked(attack_data)
|
||||
attack_data = remove_deprecated(attack_data)
|
||||
attack_data = mitre.remove_deprecated(attack_data)
|
||||
elif data_type == DATA_TYPE_STIX_ALL_GROUPS:
|
||||
attack_data = mitre.get_groups()
|
||||
attack_data = mitre.remove_revoked(attack_data)
|
||||
attack_data = remove_deprecated(attack_data)
|
||||
attack_data = mitre.remove_deprecated(attack_data)
|
||||
elif data_type == DATA_TYPE_STIX_ALL_SOFTWARE:
|
||||
attack_data = mitre.get_software()
|
||||
attack_data = mitre.remove_revoked(attack_data)
|
||||
attack_data = remove_deprecated(attack_data)
|
||||
attack_data = mitre.remove_deprecated(attack_data)
|
||||
elif data_type == DATA_TYPE_CUSTOM_TECH_BY_SOFTWARE:
|
||||
# First we need to know which technique references (STIX Object type 'attack-pattern') we have for all software
|
||||
# This results in a dict: {software_id: Sxxxx, technique_ref/attack-pattern_ref: ...}
|
||||
|
@ -195,12 +182,12 @@ def load_attack_data(data_type):
|
|||
elif data_type == DATA_TYPE_STIX_ALL_ENTERPRISE_MITIGATIONS:
|
||||
attack_data = mitre.get_enterprise_mitigations()
|
||||
attack_data = mitre.remove_revoked(attack_data)
|
||||
attack_data = remove_deprecated(attack_data)
|
||||
attack_data = mitre.remove_deprecated(attack_data)
|
||||
|
||||
elif data_type == DATA_TYPE_STIX_ALL_MOBILE_MITIGATIONS:
|
||||
attack_data = mitre.get_mobile_mitigations()
|
||||
attack_data = mitre.remove_revoked(attack_data)
|
||||
attack_data = remove_deprecated(attack_data)
|
||||
attack_data = mitre.remove_deprecated(attack_data)
|
||||
|
||||
# Only use cache when using online TAXII server:
|
||||
if local_stix_path is None:
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
attackcti==0.3.2
|
||||
simplejson==3.17.0
|
||||
plotly==4.8.1
|
||||
pandas==1.0.3
|
||||
xlsxwriter==1.2.8
|
||||
ruamel.yaml==0.16.10
|
||||
eql==0.9.1
|
||||
taxii2-client==2.0.0
|
||||
attackcti==0.3.3
|
||||
simplejson==3.17.2
|
||||
plotly==4.11.0
|
||||
pandas==1.1.3
|
||||
xlsxwriter==1.3.7
|
||||
ruamel.yaml==0.16.12
|
||||
eql==0.9.4
|
||||
taxii2-client==2.2.2
|
||||
|
|
Loading…
Reference in New Issue