pycti.entities.opencti_label

Classes

Label

Main Label class for OpenCTI

Module Contents

class pycti.entities.opencti_label.Label(opencti)[source]

Main Label class for OpenCTI

Manages labels and tags in the OpenCTI platform.

Parameters:

opencti (OpenCTIApiClient) – instance of OpenCTIApiClient

Initialize the Label instance.

Parameters:

opencti (OpenCTIApiClient) – OpenCTI API client instance

opencti[source]
properties = Multiline-String[source]
Show Value
"""
            id
            value
            color
            created_at
            updated_at
            standard_id
        """
static generate_id(value)[source]

Generate a STIX ID for a Label.

Parameters:

value (str) – The label value

Returns:

STIX ID for the label

Return type:

str

list(**kwargs)[source]

List Label 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 Label objects

Return type:

list

read(**kwargs)[source]

Read a Label object.

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

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

Returns:

Label object

Return type:

dict or None

create(**kwargs)[source]

Create a Label object.

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

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

  • color (str) – (optional) the label color

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

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

Returns:

Label object

Return type:

dict or None

read_or_create_unchecked(**kwargs)[source]

Read or create a Label.

If the user has no rights to create the label, return None.

Parameters:

value (str) – the label value

Returns:

The available or created Label object

Return type:

dict or None

update_field(**kwargs)[source]

Update a Label object field.

Parameters:
  • id (str) – the Label id

  • input (list) – the input of the field

Returns:

The updated Label object

Return type:

dict or None

delete(**kwargs)[source]

Delete a Label object.

Parameters:

id (str) – the id of the Label to delete

Returns:

None