From 01b552d7e9917171cdd84ce43dc67f627a7e87ac Mon Sep 17 00:00:00 2001 From: iglocska Date: Thu, 30 Apr 2020 07:09:56 +0200 Subject: [PATCH] Revert "Merge branch '5835' into 2.4" This reverts commit 48132af1796b13e888ecdc77fa0e25787d517242, reversing changes made to 9a22aa1f3c1295ab4715e7043e09fa3797b592cb. --- PyMISP | 2 +- app/Lib/cakephp | 2 +- app/files/misp-galaxy | 2 +- app/files/misp-objects | 2 +- app/files/scripts/stix2/stix2misp.py | 20 +++++++------------- app/files/taxonomies | 2 +- app/files/warninglists | 2 +- cti-python-stix2 | 2 +- 8 files changed, 14 insertions(+), 20 deletions(-) diff --git a/PyMISP b/PyMISP index 64d7c9a24..0faa75824 160000 --- a/PyMISP +++ b/PyMISP @@ -1 +1 @@ -Subproject commit 64d7c9a24ad9d3a7ccc1b96fb643c235d2b9e02e +Subproject commit 0faa75824f4dbac2b14919bb17e9d0fef79026d7 diff --git a/app/Lib/cakephp b/app/Lib/cakephp index d2e1681eb..5ccb12354 160000 --- a/app/Lib/cakephp +++ b/app/Lib/cakephp @@ -1 +1 @@ -Subproject commit d2e1681eb8ec75e6c2819fa113834843fed6995a +Subproject commit 5ccb12354dfc08ca1b3e0a430e8668bf1610b5d3 diff --git a/app/files/misp-galaxy b/app/files/misp-galaxy index e37f320df..c7104e881 160000 --- a/app/files/misp-galaxy +++ b/app/files/misp-galaxy @@ -1 +1 @@ -Subproject commit e37f320df5a6ba4d9c67662a3670b160e9941bcf +Subproject commit c7104e8819d6b789b24a45655aa28625a8c4c346 diff --git a/app/files/misp-objects b/app/files/misp-objects index 7ef9a2ba5..3b5451c32 160000 --- a/app/files/misp-objects +++ b/app/files/misp-objects @@ -1 +1 @@ -Subproject commit 7ef9a2ba56efc6553a720d6df27c9ee547e24242 +Subproject commit 3b5451c32518da3e29c575e868d245f27c18dcf4 diff --git a/app/files/scripts/stix2/stix2misp.py b/app/files/scripts/stix2/stix2misp.py index 41dfa72ad..f3ab86084 100644 --- a/app/files/scripts/stix2/stix2misp.py +++ b/app/files/scripts/stix2/stix2misp.py @@ -24,7 +24,7 @@ import io import re import stix2 from stix2misp_mapping import * -from collections import defaultdict, OrderedDict +from collections import defaultdict _MISP_dir = "/".join([p for p in os.path.dirname(os.path.realpath(__file__)).split('/')[:-4]]) _PyMISP_dir = '{_MISP_dir}/PyMISP'.format(_MISP_dir=_MISP_dir) @@ -107,7 +107,7 @@ class StixParser(): try: self.report[parsed_object['id'].split('--')[1]] = parsed_object except AttributeError: - self.report = OrderedDict({parsed_object['id'].split('--')[1]: parsed_object}) + self.report = {parsed_object['id'].split('--')[1]: parsed_object} def _load_usual_object(self, parsed_object): self.event[parsed_object._type][parsed_object['id'].split('--')[1]] = parsed_object @@ -128,23 +128,14 @@ class StixParser(): except PyMISPInvalidFormat: continue - def _set_info_from_report(self, report_attributes): - if report_attributes['name'] is None: - self.misp_event.info = "Imported with MISP import script for {} from {}.".format(self.stix_version, os.path.basename(self.filename)) - else: - self.misp_event.info = report_attributes['name'] - def build_from_STIX_with_report(self): report_attributes = defaultdict(set) - report_attributes['name'] = None - for ruuid, report in self.report.items(): try: report_attributes['orgs'].add(report.created_by_ref.split('--')[1]) except AttributeError: pass - if report_attributes['name'] is None: - report_attributes['name'] = report.name + report_attributes['name'].add(report.name) if report.get('published'): report_attributes['published'].add(report.published) if 'labels' in report: @@ -164,7 +155,10 @@ class StixParser(): self.misp_event['Org'] = {'name': identity['name']} if len(report_attributes['published']) == 1: self.misp_event.publish_timestamp = self.getTimestampfromDate(report_attributes['published'].pop()) - self._set_info_from_report(report_attributes) + if len(report_attributes['name']) == 1: + self.misp_event.info = report_attributes['name'].pop() + else: + self.misp_event.info = "Imported with MISP import script for {}.".format(self.stix_version) for l in report_attributes['labels']: self.misp_event.add_tag(l) diff --git a/app/files/taxonomies b/app/files/taxonomies index 0edcb08fa..8c4e2a8e8 160000 --- a/app/files/taxonomies +++ b/app/files/taxonomies @@ -1 +1 @@ -Subproject commit 0edcb08fa618f15b51a2bbf0eae6b89c5f603ded +Subproject commit 8c4e2a8e8b4d3ec287c43dcae129123fcde8cb2f diff --git a/app/files/warninglists b/app/files/warninglists index 192d11272..28687d90d 160000 --- a/app/files/warninglists +++ b/app/files/warninglists @@ -1 +1 @@ -Subproject commit 192d112728f3cab83570a0ad4f6f296e073cf738 +Subproject commit 28687d90d575332776480cd5d683361e7485033c diff --git a/cti-python-stix2 b/cti-python-stix2 index 77ca5ae2f..e4f08557e 160000 --- a/cti-python-stix2 +++ b/cti-python-stix2 @@ -1 +1 @@ -Subproject commit 77ca5ae2f9742652cd90a53f1b83308a8343f2cc +Subproject commit e4f08557ec93c589a71a6e4060134661f1c4b2c0