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

Commit 3f089c9

Browse files
committed
[client] Add the method promote_to_indicator in SCO class (#255)
1 parent e8c4d4d commit 3f089c9

File tree

2 files changed

+41
-1
lines changed

2 files changed

+41
-1
lines changed

pycti/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# -*- coding: utf-8 -*-
2-
__version__ = "5.3.0"
2+
__version__ = "5.3.1"
33

44
from .api.opencti_api_client import OpenCTIApiClient
55
from .api.opencti_api_connector import OpenCTIApiConnector

pycti/entities/opencti_stix_cyber_observable.py

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1282,6 +1282,46 @@ def update_field(self, **kwargs):
12821282
)
12831283
return None
12841284

1285+
"""
1286+
Promote a Stix-Observable to an Indicator
1287+
1288+
:param id: the Stix-Observable id
1289+
:return void
1290+
"""
1291+
1292+
def promote_to_indicator(self, **kwargs):
1293+
id = kwargs.get("id", None)
1294+
custom_attributes = kwargs.get("customAttributes", None)
1295+
if id is not None:
1296+
self.opencti.log("info", "Promoting Stix-Observable {" + id + "}.")
1297+
query = (
1298+
"""
1299+
mutation StixCyberObservableEdit($id: ID!) {
1300+
stixCyberObservableEdit(id: $id) {
1301+
promote {
1302+
"""
1303+
+ (
1304+
custom_attributes
1305+
if custom_attributes is not None
1306+
else self.properties
1307+
)
1308+
+ """
1309+
}
1310+
}
1311+
}
1312+
"""
1313+
)
1314+
result = self.opencti.query(query, {"id": id})
1315+
return self.opencti.process_multiple_fields(
1316+
result["data"]["stixCyberObservableEdit"]["promote"]
1317+
)
1318+
else:
1319+
self.opencti.log(
1320+
"error",
1321+
"[opencti_stix_cyber_observable_promote] Missing parameters: id",
1322+
)
1323+
return None
1324+
12851325
"""
12861326
Delete a Stix-Observable
12871327

0 commit comments

Comments
 (0)