pycti.entities.opencti_location
Classes
Main Location class for OpenCTI |
Module Contents
- class pycti.entities.opencti_location.Location(opencti)[source]
Main Location class for OpenCTI
Manages geographic locations (countries, cities, regions) in the OpenCTI platform.
- Parameters:
opencti (OpenCTIApiClient) – instance of
OpenCTIApiClient
Initialize the Location instance.
- Parameters:
opencti (OpenCTIApiClient) – OpenCTI API client instance
- properties = Multiline-String[source]
Show Value
""" 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 """
- properties_with_files = Multiline-String[source]
Show Value
""" 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 } } } } """
- static generate_id(name, x_opencti_location_type, latitude=None, longitude=None)[source]
Generate a STIX ID for a Location.
- Parameters:
name (str) – The name of the location
x_opencti_location_type (str) – The type of location (Country, City, Region, Position)
latitude (float or None) – Optional latitude coordinate
longitude (float or None) – Optional longitude coordinate
- Returns:
STIX ID for the location
- Return type:
str
- static generate_id_from_data(data)[source]
Generate a STIX ID from location data.
- Parameters:
data (dict) – Dictionary containing ‘name’, ‘x_opencti_location_type’, and optionally ‘latitude’/’longitude’
- Returns:
STIX ID for the location
- Return type:
str
- list(**kwargs)[source]
List Location objects.
- Parameters:
types (list) – the list of location types to filter by
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
withFiles (bool) – whether to include files
- Returns:
List of Location objects
- Return type:
list
- read(**kwargs)[source]
Read a Location object.
- Parameters:
id (str) – the id of the Location
filters (dict) – the filters to apply if no id provided
customAttributes (list) – custom attributes to return
withFiles (bool) – whether to include files
- Returns:
Location object
- Return type:
dict or None
- create(**kwargs)[source]
Create a Location object.
- Parameters:
type (str) – the type of location (Country, City, Region, Position)
stix_id (str) – (optional) the STIX ID
createdBy (str) – (optional) the author ID
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 location is revoked
confidence (int) – (optional) confidence level (0-100)
lang (str) – (optional) language
created (datetime) – (optional) creation date
modified (datetime) – (optional) modification date
name (str) – the name of the Location (required)
description (str) – (optional) description
latitude (float) – (optional) latitude coordinate
longitude (float) – (optional) longitude coordinate
precision (float) – (optional) precision in meters
x_opencti_aliases (list) – (optional) list of aliases
x_opencti_stix_ids (list) – (optional) list of additional STIX IDs
x_opencti_workflow_id (str) – (optional) workflow ID
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:
Location object
- Return type:
dict or None