pycti.entities.opencti_opinion

class pycti.entities.opencti_opinion.Opinion(opencti)[source]

Main Opinion class for OpenCTI

Manages analyst opinions and assessments in the OpenCTI platform.

Parameters:

opencti (OpenCTIApiClient) – instance of OpenCTIApiClient

__init__(opencti)[source]

Initialize the Opinion instance.

Parameters:

opencti (OpenCTIApiClient) – OpenCTI API client instance

add_stix_object_or_stix_relationship(**kwargs)[source]

Add a Stix-Entity object to Opinion object (object_refs).

Parameters:
  • id (str) – the id of the Opinion

  • stixObjectOrStixRelationshipId (str) – the id of the Stix-Entity

Returns:

Boolean

Return type:

bool

contains_stix_object_or_stix_relationship(**kwargs)[source]

Check if an opinion already contains a STIX entity.

Parameters:
  • id (str) – the id of the Opinion

  • stixObjectOrStixRelationshipId (str) – the id of the Stix-Entity

Returns:

Boolean

Return type:

bool

create(**kwargs)[source]

Create an Opinion object.

Parameters:
  • stix_id (str) – (optional) the STIX ID

  • createdBy (str) – (optional) the author ID

  • objects (list) – (optional) list of STIX object IDs

  • objectMarking (list) – (optional) list of marking definition IDs

  • objectLabel (list) – (optional) list of label IDs

  • externalReferences (list) – (optional) list of external reference IDs

  • revoked (bool) – (optional) whether the opinion is revoked

  • confidence (int) – (optional) confidence level (0-100)

  • lang (str) – (optional) language

  • created (datetime) – (optional) creation date

  • modified (datetime) – (optional) modification date

  • explanation (str) – (optional) explanation text

  • authors (list) – (optional) list of authors

  • opinion (str) – the opinion value (required)

  • x_opencti_stix_ids (list) – (optional) list of additional STIX IDs

  • objectOrganization (list) – (optional) list of organization IDs

  • x_opencti_modified_at (datetime) – (optional) custom modification date

  • update (bool) – (optional) whether to update if exists (default: False)

  • files (list) – (optional) list of File objects to attach

  • filesMarkings (list) – (optional) list of lists of marking definition IDs for each file

Returns:

Opinion object

Return type:

dict or None

static generate_id(created, opinion)[source]

Generate a STIX ID for an Opinion.

Parameters:
  • created (datetime or str or None) – The creation date of the opinion

  • opinion (str) – The opinion value (required)

Returns:

STIX ID for the opinion

Return type:

str

Raises:

ValueError – If opinion is None

static generate_id_from_data(data)[source]

Generate a STIX ID from opinion data.

Parameters:

data (dict) – Dictionary containing ‘opinion’ and optionally ‘created’ keys

Returns:

STIX ID for the opinion

Return type:

str

import_from_stix2(**kwargs)[source]

Import an Opinion object from a STIX2 object.

Parameters:
  • stixObject (dict) – the Stix-Object Opinion

  • extras (dict) – extra dict

  • update (bool) – set the update flag on import

Returns:

Opinion object

Return type:

dict or None

list(**kwargs)[source]

List Opinion objects.

Parameters:
  • filters (dict) – the filters to apply

  • search (str) – the search keyword

  • first (int) – return the first n rows from the after ID (or the beginning if not set)

  • after (str) – ID of the first row for pagination

  • orderBy (str) – field to order results by

  • orderMode (str) – ordering mode (asc/desc)

  • customAttributes (list) – custom attributes to return

  • getAll (bool) – whether to retrieve all results

  • withPagination (bool) – whether to include pagination info

Returns:

List of Opinion objects

Return type:

list

read(**kwargs)[source]

Read an Opinion object.

Parameters:
  • id (str) – the id of the Opinion

  • filters (dict) – the filters to apply if no id provided

  • customAttributes (list) – custom attributes to return

Returns:

Opinion object

Return type:

dict or None

remove_stix_object_or_stix_relationship(**kwargs)[source]

Remove a Stix-Entity object from Opinion object (object_refs).

Parameters:
  • id (str) – the id of the Opinion

  • stixObjectOrStixRelationshipId (str) – the id of the Stix-Entity

Returns:

Boolean

Return type:

bool