pycti.entities.opencti_identity

class pycti.entities.opencti_identity.Identity(opencti)[source]

Main Identity class for OpenCTI

Manages individual, organization, and system identities in OpenCTI.

Parameters:

opencti (OpenCTIApiClient) – instance of OpenCTIApiClient

__init__(opencti)[source]

Initialize the Identity instance.

Parameters:

opencti (OpenCTIApiClient) – OpenCTI API client instance

create(**kwargs)[source]

Create an Identity object.

Parameters:
  • type – the type of identity (Organization, Individual, System, etc.) (required)

  • stix_id – (optional) the STIX ID

  • createdBy – (optional) the author ID

  • objectMarking – (optional) list of marking definition IDs

  • objectLabel – (optional) list of label IDs

  • externalReferences – (optional) list of external reference IDs

  • revoked – (optional) whether the identity is revoked

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

  • lang – (optional) language

  • created – (optional) creation date

  • modified – (optional) modification date

  • name – the name of the Identity (required)

  • description – (optional) description

  • contact_information – (optional) contact information

  • roles – (optional) list of roles

  • x_opencti_aliases – (optional) list of aliases

  • security_platform_type – (optional) type of security platform

  • x_opencti_organization_type – (optional) organization type

  • x_opencti_reliability – (optional) reliability level

  • x_opencti_score – (optional) score

  • x_opencti_firstname – (optional) first name for individuals

  • x_opencti_lastname – (optional) last name for individuals

  • x_opencti_stix_ids – (optional) list of additional STIX IDs

  • objectOrganization – (optional) list of organization IDs

  • x_opencti_workflow_id – (optional) workflow ID

  • x_opencti_modified_at – (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:

Identity object

Return type:

dict or None

static generate_id(name, identity_class)[source]

Generate a STIX ID for an Identity.

Parameters:
  • name (str) – The name of the identity

  • identity_class (str) – The class of the identity (individual, group, organization, etc.)

Returns:

STIX ID for the identity

Return type:

str

static generate_id_from_data(data)[source]

Generate a STIX ID from identity data.

Parameters:

data (dict) – Dictionary containing ‘name’ and ‘identity_class’ keys

Returns:

STIX ID for the identity

Return type:

str

import_from_stix2(**kwargs)[source]

Import an Identity object from a STIX2 object.

Parameters:
  • stixObject (dict) – the STIX2 Identity object

  • extras (dict) – extra parameters including created_by_id, object_marking_ids, etc.

  • update (bool) – whether to update if the entity already exists

Returns:

Identity object

Return type:

dict or None

list(**kwargs)[source]

List Identity objects.

Parameters:
  • types (list) – the list of types

  • 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 (str) – custom attributes to return

  • getAll (bool) – whether to retrieve all results

  • withPagination (bool) – whether to include pagination info

  • withFiles (bool) – whether to include files

Returns:

List of Identity objects

Return type:

list

read(**kwargs)[source]

Read an Identity object.

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

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

  • customAttributes (str) – custom attributes to return

  • withFiles (bool) – whether to include files

Returns:

Identity object

Return type:

dict or None