pycti.entities.opencti_location
===============================
.. py:module:: pycti.entities.opencti_location
Classes
-------
.. autoapisummary::
pycti.entities.opencti_location.Location
Module Contents
---------------
.. py:class:: Location(opencti)
Main Location class for OpenCTI
Manages geographic locations (countries, cities, regions) in the OpenCTI platform.
:param opencti: instance of :py:class:`~pycti.api.opencti_api_client.OpenCTIApiClient`
:type opencti: OpenCTIApiClient
Initialize the Location 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
created
modified
objectLabel {
id
value
color
}
}
... on Organization {
x_opencti_organization_type
x_opencti_reliability
}
... on Individual {
x_opencti_firstname
x_opencti_lastname
}
}
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
name
description
latitude
longitude
precision
x_opencti_aliases
"""
.. 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
created
modified
objectLabel {
id
value
color
}
}
... on Organization {
x_opencti_organization_type
x_opencti_reliability
}
... on Individual {
x_opencti_firstname
x_opencti_lastname
}
}
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
name
description
latitude
longitude
precision
x_opencti_aliases
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, x_opencti_location_type, latitude=None, longitude=None)
:staticmethod:
Generate a STIX ID for a Location.
:param name: The name of the location
:type name: str
:param x_opencti_location_type: The type of location (Country, City, Region, Position)
:type x_opencti_location_type: str
:param latitude: Optional latitude coordinate
:type latitude: float or None
:param longitude: Optional longitude coordinate
:type longitude: float or None
:return: STIX ID for the location
:rtype: str
.. py:method:: generate_id_from_data(data)
:staticmethod:
Generate a STIX ID from location data.
:param data: Dictionary containing 'name', 'x_opencti_location_type', and optionally 'latitude'/'longitude'
:type data: dict
:return: STIX ID for the location
:rtype: str
.. py:method:: list(**kwargs)
List Location objects.
:param types: the list of location types to filter by
: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: list
: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 Location objects
:rtype: list
.. py:method:: read(**kwargs)
Read a Location object.
:param id: the id of the Location
:type id: str
:param filters: the filters to apply if no id provided
:type filters: dict
:param customAttributes: custom attributes to return
:type customAttributes: list
:param withFiles: whether to include files
:type withFiles: bool
:return: Location object
:rtype: dict or None
.. py:method:: create(**kwargs)
Create a Location object.
:param type: the type of location (Country, City, Region, Position)
:type type: str
:param stix_id: (optional) the STIX ID
:type stix_id: str
:param createdBy: (optional) the author ID
:type createdBy: str
:param objectMarking: (optional) list of marking definition IDs
:type objectMarking: list
:param objectLabel: (optional) list of label IDs
:type objectLabel: list
:param externalReferences: (optional) list of external reference IDs
:type externalReferences: list
:param revoked: (optional) whether the location is revoked
:type revoked: bool
:param confidence: (optional) confidence level (0-100)
:type confidence: int
:param lang: (optional) language
:type lang: str
:param created: (optional) creation date
:type created: datetime
:param modified: (optional) modification date
:type modified: datetime
:param name: the name of the Location (required)
:type name: str
:param description: (optional) description
:type description: str
:param latitude: (optional) latitude coordinate
:type latitude: float
:param longitude: (optional) longitude coordinate
:type longitude: float
:param precision: (optional) precision in meters
:type precision: float
:param x_opencti_aliases: (optional) list of aliases
:type x_opencti_aliases: list
:param x_opencti_stix_ids: (optional) list of additional STIX IDs
:type x_opencti_stix_ids: list
:param x_opencti_workflow_id: (optional) workflow ID
:type x_opencti_workflow_id: str
:param x_opencti_modified_at: (optional) custom modification date
:type x_opencti_modified_at: datetime
: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: Location object
:rtype: dict or None
.. py:method:: import_from_stix2(**kwargs)
Import a Location object from a STIX2 object.
:param stixObject: the Stix-Object Location
:type stixObject: dict
:param extras: extra dict
:type extras: dict
:param update: set the update flag on import
:type update: bool
:return: Location object
:rtype: dict or None