MISP / MISP-STIX-Converter

A utility repo to assist with converting between MISP and STIX formats
GNU Lesser General Public License v3.0
64 stars 31 forks source link

Error Download as "STIX 1 JSON (metadata + all attributes)" #43

Open jarandas opened 2 years ago

jarandas commented 2 years ago

When I download event from MISP Download as -> STIX 1 JSON (metadata + all attributes) or STIX 2 It doesn't work on a fresh installation of MISP v2.4.150

Data: MISP v2.4.150 Python 3.6.8 CentOS 7 Guide: https://misp.github.io/MISP/INSTALL.rhel7/

Traceback (most recent call last):
 File "/var/www/MISP/app/files/scripts/stix2/misp2stix2.py", line 34, in <module>
 from misp_stix_converter import MISPtoSTIX20Parser, MISPtoSTIX21Parser
 File "/var/www/MISP/app/files/scripts/misp-stix/misp_stix_converter/__init__.py", line 3, in <module>
 from .misp_stix_converter import misp_attribute_collection_to_stix1, misp_collection_to_stix2_0, misp_collection_to_stix2_1, misp_event_collection_to_stix1, misp_to_stix1, misp_to_stix2_0, misp_to_stix2_1
 File "/var/www/MISP/app/files/scripts/misp-stix/misp_stix_converter/misp_stix_converter.py", line 22, in <module>
 from typing import List, TypedDict, Union
ImportError: cannot import name 'TypedDict'

I solve the error as follows: References: https://pypi.org/project/typing-extensions/

git diff misp_stix_converter.py
diff --git a/misp_stix_converter/misp_stix_converter.py b/misp_stix_converter/misp_stix_converter.py
index 1ec7fa2..636cbe8 100644
--- a/misp_stix_converter/misp_stix_converter.py
+++ b/misp_stix_converter/misp_stix_converter.py
@@ -19,7 +19,8 @@ from stix.core.ttps import TTPs
 from stix2.base import STIXJSONEncoder
 from stix2.v20 import Bundle as Bundle_v20
 from stix2.v21 import Bundle as Bundle_v21
-from typing import List, TypedDict, Union
+from typing import List, Union
+from typing_extensions import TypedDict
 from uuid import uuid4

 _default_namespace = 'https://github.com/MISP/MISP'

Regards