[client] Support workflow at identity /malware / incident creation (#… · curiouspython1/client-python@d2512c5 · GitHub
Skip to content

Commit d2512c5

Browse files
committed
[client] Support workflow at identity /malware / incident creation (OpenCTI-Platform#433)
1 parent e4e8b73 commit d2512c5

4 files changed

Lines changed: 29 additions & 2 deletions

File tree

pycti/entities/opencti_case_incident.py

Lines changed: 2 additions & 2 deletions

pycti/entities/opencti_identity.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -303,6 +303,7 @@ def create(self, **kwargs):
303303
x_opencti_firstname = kwargs.get("x_opencti_firstname", None)
304304
x_opencti_lastname = kwargs.get("x_opencti_lastname", None)
305305
x_opencti_stix_ids = kwargs.get("x_opencti_stix_ids", None)
306+
x_opencti_workflow_id = kwargs.get("x_opencti_workflow_id", None)
306307
update = kwargs.get("update", False)
307308

308309
if type is not None and name is not None:
@@ -324,6 +325,7 @@ def create(self, **kwargs):
324325
"roles": roles,
325326
"x_opencti_aliases": x_opencti_aliases,
326327
"x_opencti_stix_ids": x_opencti_stix_ids,
328+
"x_opencti_workflow_id": x_opencti_workflow_id,
327329
"update": update,
328330
}
329331
if type == IdentityTypes.ORGANIZATION.value:
@@ -451,6 +453,12 @@ def import_from_stix2(self, **kwargs):
451453
stix_object[
452454
"x_opencti_stix_ids"
453455
] = self.opencti.get_attribute_in_extension("stix_ids", stix_object)
456+
if "x_opencti_workflow_id" not in stix_object:
457+
stix_object[
458+
"x_opencti_workflow_id"
459+
] = self.opencti.get_attribute_in_extension(
460+
"x_opencti_workflow_id", stix_object
461+
)
454462

455463
return self.create(
456464
type=type,
@@ -502,6 +510,9 @@ def import_from_stix2(self, **kwargs):
502510
x_opencti_stix_ids=stix_object["x_opencti_stix_ids"]
503511
if "x_opencti_stix_ids" in stix_object
504512
else None,
513+
x_opencti_workflow_id=stix_object["x_opencti_workflow_id"]
514+
if "x_opencti_workflow_id" in stix_object
515+
else None,
505516
update=update,
506517
)
507518
else:

pycti/entities/opencti_incident.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -298,6 +298,7 @@ def create(self, **kwargs):
298298
source = kwargs.get("source", None)
299299
x_opencti_stix_ids = kwargs.get("x_opencti_stix_ids", None)
300300
granted_refs = kwargs.get("objectOrganization", None)
301+
x_opencti_workflow_id = kwargs.get("x_opencti_workflow_id", None)
301302
update = kwargs.get("update", False)
302303

303304
if name is not None:
@@ -337,6 +338,7 @@ def create(self, **kwargs):
337338
"severity": severity,
338339
"source": source,
339340
"x_opencti_stix_ids": x_opencti_stix_ids,
341+
"x_opencti_workflow_id": x_opencti_workflow_id,
340342
"update": update,
341343
}
342344
},
@@ -415,6 +417,9 @@ def import_from_stix2(self, **kwargs):
415417
objectOrganization=stix_object["x_opencti_granted_refs"]
416418
if "x_opencti_granted_refs" in stix_object
417419
else None,
420+
x_opencti_workflow_id=stix_object["x_opencti_workflow_id"]
421+
if "x_opencti_workflow_id" in stix_object
422+
else None,
418423
update=update,
419424
)
420425
else:

pycti/entities/opencti_malware.py

Lines changed: 11 additions & 0 deletions

0 commit comments

Comments
 (0)