Skip to content

Commit bbd2faa

Browse files
aHenryJardKedae
authored andcommitted
WithFiles was not requested when full export of report (#686)
(cherry picked from commit e5f6120)
1 parent 127e160 commit bbd2faa

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

pycti/entities/opencti_report.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -504,7 +504,8 @@ def list(self, **kwargs):
504504
first = 100
505505

506506
self.opencti.app_logger.info(
507-
"Listing Reports with filters", {"filters": json.dumps(filters)}
507+
"Listing Reports with filters",
508+
{"filters": json.dumps(filters), "with_files:": with_files},
508509
)
509510
query = (
510511
"""
@@ -583,7 +584,9 @@ def read(self, **kwargs):
583584
custom_attributes = kwargs.get("customAttributes", None)
584585
with_files = kwargs.get("withFiles", False)
585586
if id is not None:
586-
self.opencti.app_logger.info("Reading Report", {"id": id})
587+
self.opencti.app_logger.info(
588+
"Reading Report", {"id": id, "with_files": with_files}
589+
)
587590
query = (
588591
"""
589592
query Report($id: String!) {
@@ -602,7 +605,7 @@ def read(self, **kwargs):
602605
result = self.opencti.query(query, {"id": id})
603606
return self.opencti.process_multiple_fields(result["data"]["report"])
604607
elif filters is not None:
605-
result = self.list(filters=filters)
608+
result = self.list(filters=filters, withFiles=with_files)
606609
if len(result) > 0:
607610
return result[0]
608611
else:

pycti/utils/opencti_stix2.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2188,7 +2188,7 @@ def get_stix_bundle_or_object_from_entity_id(
21882188
"objects": [],
21892189
}
21902190
do_read = self.get_reader(entity_type)
2191-
entity = do_read(id=entity_id)
2191+
entity = do_read(id=entity_id, withFiles=(mode == "full"))
21922192
if entity is None:
21932193
self.opencti.app_logger.error(
21942194
"Cannot export entity (not found)", {"id": entity_id}
@@ -2237,6 +2237,7 @@ def export_entities_list(
22372237
orderBy: str = None,
22382238
orderMode: str = None,
22392239
getAll: bool = True,
2240+
withFiles: bool = False,
22402241
) -> [Dict]:
22412242
if IdentityTypes.has_value(entity_type):
22422243
entity_type = "Identity"
@@ -2300,6 +2301,7 @@ def export_entities_list(
23002301
orderBy=orderBy,
23012302
orderMode=orderMode,
23022303
getAll=getAll,
2304+
withFiles=withFiles,
23032305
)
23042306

23052307
def export_list(
@@ -2334,6 +2336,7 @@ def export_list(
23342336
orderBy=order_by,
23352337
orderMode=order_mode,
23362338
getAll=True,
2339+
withFiles=(mode == "full"),
23372340
)
23382341
if entities_list is not None:
23392342
uuids = []

0 commit comments

Comments
 (0)