Skip to content
This repository was archived by the owner on Dec 5, 2025. It is now read-only.

Commit 9a31fd1

Browse files
author
Samuel Hassine
committed
[client] Fix export of files
1 parent a16fea1 commit 9a31fd1

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

pycti/utils/opencti_stix2.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -917,6 +917,10 @@ def generate_export(self, entity):
917917
entity["region"] = entity["name"]
918918
entity["entity_type"] = "Location"
919919

920+
# Files
921+
if entity["entity_type"] == "StixFile":
922+
entity["entity_type"] = "File"
923+
920924
# Indicators
921925
if "pattern" in entity and "x-opencti-hostname" in entity["pattern"]:
922926
entity["pattern"] = entity["pattern"].replace(
@@ -967,6 +971,9 @@ def generate_export(self, entity):
967971
if "externalReferences" in entity:
968972
del entity["externalReferences"]
969973
del entity["externalReferencesIds"]
974+
if "indicators" in entity:
975+
del entity["indicators"]
976+
del entity["indicatorsIds"]
970977
if "hashes" in entity:
971978
hashes = entity["hashes"]
972979
entity["hashes"] = {}
@@ -1025,7 +1032,6 @@ def prepare_export(
10251032
del entity["createdById"]
10261033
if "observables" in entity:
10271034
del entity["observables"]
1028-
if "observablesIds" in entity:
10291035
del entity["observablesIds"]
10301036

10311037
entity_copy = entity.copy()
@@ -1463,7 +1469,6 @@ def export_list(
14631469
types=types,
14641470
getAll=True,
14651471
)
1466-
14671472
if entities_list is not None:
14681473
uuids = []
14691474
for entity in entities_list:
@@ -1477,7 +1482,6 @@ def export_list(
14771482
for x in entity_bundle_filtered:
14781483
uuids.append(x["id"])
14791484
bundle["objects"] = bundle["objects"] + entity_bundle_filtered
1480-
14811485
return bundle
14821486

14831487
def import_bundle(self, stix_bundle, update=False, types=None) -> List:

0 commit comments

Comments
 (0)