From 84560333371bc36731738501bd85b2ce2600ff61 Mon Sep 17 00:00:00 2001 From: Marcus Bakker Date: Fri, 16 Oct 2020 11:36:05 +0200 Subject: [PATCH] updatd the Python packages --- editor/script/refresh_attack_data.py | 16 ++-------------- editor/script/requirements.txt | 2 +- generic.py | 27 +++++++-------------------- requirements.txt | 16 ++++++++-------- 4 files changed, 18 insertions(+), 43 deletions(-) diff --git a/editor/script/refresh_attack_data.py b/editor/script/refresh_attack_data.py index b8cef95..6f3d2f7 100644 --- a/editor/script/refresh_attack_data.py +++ b/editor/script/refresh_attack_data.py @@ -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): """ diff --git a/editor/script/requirements.txt b/editor/script/requirements.txt index a2c112d..39510eb 100644 --- a/editor/script/requirements.txt +++ b/editor/script/requirements.txt @@ -1 +1 @@ -attackcti==0.3.2 \ No newline at end of file +attackcti==0.3.3 \ No newline at end of file diff --git a/generic.py b/generic.py index afebfb0..c8a2b37 100644 --- a/generic.py +++ b/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: diff --git a/requirements.txt b/requirements.txt index b6f2eba..ec45a54 100644 --- a/requirements.txt +++ b/requirements.txt @@ -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