pycti.entities.opencti_identity
===============================
.. py:module:: pycti.entities.opencti_identity
Classes
-------
.. autoapisummary::
pycti.entities.opencti_identity.Identity
Module Contents
---------------
.. py:class:: Identity(opencti)
Main Identity class for OpenCTI
Manages individual, organization, and system identities in OpenCTI.
:param opencti: instance of :py:class:`~pycti.api.opencti_api_client.OpenCTIApiClient`
:type opencti: OpenCTIApiClient
Initialize the Identity instance.
:param opencti: OpenCTI API client instance
:type opencti: OpenCTIApiClient
.. py:attribute:: opencti
.. py:attribute:: properties
:value: Multiline-String
.. raw:: html
Show Value
.. code-block:: python
"""
id
standard_id
entity_type
parent_types
spec_version
created_at
updated_at
status {
id
template {
id
name
color
}
}
createdBy {
... on Identity {
id
standard_id
entity_type
parent_types
spec_version
identity_class
name
description
roles
contact_information
x_opencti_aliases
x_opencti_reliability
created
modified
objectLabel {
id
value
color
}
}
... on Organization {
x_opencti_organization_type
x_opencti_score
}
... on Individual {
x_opencti_firstname
x_opencti_lastname
}
... on SecurityPlatform {
security_platform_type
}
}
objectMarking {
id
standard_id
entity_type
definition_type
definition
created
modified
x_opencti_order
x_opencti_color
}
objectOrganization {
id
standard_id
name
}
objectLabel {
id
value
color
}
externalReferences {
edges {
node {
id
standard_id
entity_type
source_name
description
url
hash
external_id
created
modified
}
}
}
revoked
confidence
created
modified
identity_class
name
description
x_opencti_aliases
x_opencti_reliability
contact_information
... on Individual {
x_opencti_firstname
x_opencti_lastname
}
... on Organization {
x_opencti_organization_type
x_opencti_score
}
... on SecurityPlatform {
security_platform_type
}
"""
.. raw:: html
.. py:attribute:: properties_with_files
:value: Multiline-String
.. raw:: html
Show Value
.. code-block:: python
"""
id
standard_id
entity_type
parent_types
spec_version
created_at
updated_at
status {
id
template {
id
name
color
}
}
createdBy {
... on Identity {
id
standard_id
entity_type
parent_types
spec_version
identity_class
name
description
roles
contact_information
x_opencti_aliases
x_opencti_reliability
created
modified
objectLabel {
id
value
color
}
}
... on Organization {
x_opencti_organization_type
x_opencti_score
}
... on Individual {
x_opencti_firstname
x_opencti_lastname
}
... on SecurityPlatform {
security_platform_type
}
}
objectMarking {
id
standard_id
entity_type
definition_type
definition
created
modified
x_opencti_order
x_opencti_color
}
objectOrganization {
id
standard_id
name
}
objectLabel {
id
value
color
}
externalReferences {
edges {
node {
id
standard_id
entity_type
source_name
description
url
hash
external_id
created
modified
importFiles {
edges {
node {
id
name
size
metaData {
mimetype
version
}
}
}
}
}
}
}
revoked
confidence
created
modified
identity_class
name
description
x_opencti_aliases
x_opencti_reliability
contact_information
... on Individual {
x_opencti_firstname
x_opencti_lastname
}
... on Organization {
x_opencti_organization_type
x_opencti_score
}
... on SecurityPlatform {
security_platform_type
}
importFiles {
edges {
node {
id
name
size
metaData {
mimetype
version
}
objectMarking {
id
standard_id
entity_type
definition_type
definition
created
modified
x_opencti_order
x_opencti_color
}
}
}
}
"""
.. raw:: html
.. py:method:: generate_id(name, identity_class)
:staticmethod:
Generate a STIX ID for an Identity.
:param name: The name of the identity
:type name: str
:param identity_class: The class of the identity (individual, group, organization, etc.)
:type identity_class: str
:return: STIX ID for the identity
:rtype: str
.. py:method:: generate_id_from_data(data)
:staticmethod:
Generate a STIX ID from identity data.
:param data: Dictionary containing 'name' and 'identity_class' keys
:type data: dict
:return: STIX ID for the identity
:rtype: str
.. py:method:: list(**kwargs)
List Identity objects.
:param types: the list of types
:type types: list
:param filters: the filters to apply
:type filters: dict
:param search: the search keyword
:type search: str
:param first: return the first n rows from the after ID (or the beginning if not set)
:type first: int
:param after: ID of the first row for pagination
:type after: str
:param orderBy: field to order results by
:type orderBy: str
:param orderMode: ordering mode (asc/desc)
:type orderMode: str
:param customAttributes: custom attributes to return
:type customAttributes: str
:param getAll: whether to retrieve all results
:type getAll: bool
:param withPagination: whether to include pagination info
:type withPagination: bool
:param withFiles: whether to include files
:type withFiles: bool
:return: List of Identity objects
:rtype: list
.. py:method:: read(**kwargs)
Read an Identity object.
:param id: the id of the Identity
:type id: str
:param filters: the filters to apply if no id provided
:type filters: dict
:param customAttributes: custom attributes to return
:type customAttributes: str
:param withFiles: whether to include files
:type withFiles: bool
:return: Identity object
:rtype: dict or None
.. py:method:: create(**kwargs)
Create an Identity object.
:param type: the type of identity (Organization, Individual, System, etc.) (required)
:param stix_id: (optional) the STIX ID
:param createdBy: (optional) the author ID
:param objectMarking: (optional) list of marking definition IDs
:param objectLabel: (optional) list of label IDs
:param externalReferences: (optional) list of external reference IDs
:param revoked: (optional) whether the identity is revoked
:param confidence: (optional) confidence level (0-100)
:param lang: (optional) language
:param created: (optional) creation date
:param modified: (optional) modification date
:param name: the name of the Identity (required)
:param description: (optional) description
:param contact_information: (optional) contact information
:param roles: (optional) list of roles
:param x_opencti_aliases: (optional) list of aliases
:param security_platform_type: (optional) type of security platform
:param x_opencti_organization_type: (optional) organization type
:param x_opencti_reliability: (optional) reliability level
:param x_opencti_score: (optional) score
:param x_opencti_firstname: (optional) first name for individuals
:param x_opencti_lastname: (optional) last name for individuals
:param x_opencti_stix_ids: (optional) list of additional STIX IDs
:param objectOrganization: (optional) list of organization IDs
:param x_opencti_workflow_id: (optional) workflow ID
:param x_opencti_modified_at: (optional) custom modification date
:param update: (optional) whether to update if exists (default: False)
:type update: bool
:param files: (optional) list of File objects to attach
:type files: list
:param filesMarkings: (optional) list of lists of marking definition IDs for each file
:type filesMarkings: list
:return: Identity object
:rtype: dict or None
.. py:method:: import_from_stix2(**kwargs)
Import an Identity object from a STIX2 object.
:param stixObject: the STIX2 Identity object
:type stixObject: dict
:param extras: extra parameters including created_by_id, object_marking_ids, etc.
:type extras: dict
:param update: whether to update if the entity already exists
:type update: bool
:return: Identity object
:rtype: dict or None