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

Commit bfd467c

Browse files
author
Samuel Hassine
committed
[client] Fix indicator search by pattern
1 parent e6f6a20 commit bfd467c

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

pycti/entities/opencti_indicator.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -292,6 +292,8 @@ def create_raw(self, **kwargs):
292292
}
293293
"""
294294
)
295+
if pattern_type is None:
296+
pattern_type = "stix2"
295297
result = self.opencti.query(
296298
query,
297299
{
@@ -363,16 +365,18 @@ def create(self, **kwargs):
363365
}
364366
}
365367
"""
366-
object_result = self.opencti.indicator.read(
367-
id=stix_id_key, customAttributes=custom_attributes
368-
)
368+
object_result = None
369+
if stix_id_key is not None:
370+
object_result = self.opencti.indicator.read(
371+
id=stix_id_key, customAttributes=custom_attributes
372+
)
369373
if object_result is None:
370374
object_result = self.read(
371375
filters=[
372376
{
373377
"key": "indicator_pattern",
374378
"values": [indicator_pattern],
375-
"operator": "match",
379+
"operator": "match" if len(indicator_pattern) > 500 else "eq",
376380
}
377381
],
378382
customAttributes=custom_attributes,

0 commit comments

Comments
 (0)