pycti.entities.opencti_note
- class pycti.entities.opencti_note.Note(opencti)[source]
Main Note class for OpenCTI
Manages notes and annotations in the OpenCTI platform.
- Parameters:
opencti (OpenCTIApiClient) – instance of
OpenCTIApiClient
- __init__(opencti)[source]
Initialize the Note instance.
- Parameters:
opencti (OpenCTIApiClient) – OpenCTI API client instance
- add_stix_object_or_stix_relationship(**kwargs)[source]
Add a Stix-Entity object to Note object (object_refs).
- Parameters:
id (str) – the id of the Note
stixObjectOrStixRelationshipId (str) – the id of the Stix-Entity
- Returns:
Boolean
- Return type:
bool
- contains_stix_object_or_stix_relationship(**kwargs)[source]
Check if a note already contains a STIX entity.
- Parameters:
id (str) – the id of the Note
stixObjectOrStixRelationshipId (str) – the id of the Stix-Entity
- Returns:
Boolean
- Return type:
bool
- create(**kwargs)[source]
Create a Note object.
- Parameters:
stix_id (str) – (optional) the STIX ID
createdBy (str) – (optional) the author ID
objects (list) – (optional) list of STIX object IDs
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 note is revoked
confidence (int) – (optional) confidence level (0-100)
lang (str) – (optional) language
created (datetime) – (optional) creation date
modified (datetime) – (optional) modification date
abstract (str) – (optional) abstract summary
content (str) – the content of the Note (required)
authors (list) – (optional) list of authors
note_types (list) – (optional) list of note types
likelihood (int) – (optional) likelihood value
x_opencti_stix_ids (list) – (optional) list of additional STIX IDs
objectOrganization (list) – (optional) list of organization 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:
Note object
- Return type:
dict or None
- static generate_id(created, content, abstract=None)[source]
Generate a STIX ID for a Note.
- Parameters:
created (datetime or str or None) – The creation date of the note
content (str) – The content of the note (required)
abstract (str or None) – A brief summary of the note content
- Returns:
STIX ID for the note
- Return type:
str
- Raises:
ValueError – If content is None
- static generate_id_from_data(data)[source]
Generate a STIX ID from note data.
- Parameters:
data (dict) – Dictionary containing ‘content’ and optionally ‘created’ and ‘attribute_abstract’ keys
- Returns:
STIX ID for the note
- Return type:
str
- import_from_stix2(**kwargs)[source]
Import a Note object from a STIX2 object.
- Parameters:
stixObject (dict) – the Stix-Object Note
extras (dict) – extra dict
update (bool) – set the update flag on import
- Returns:
Note object
- Return type:
dict or None
- list(**kwargs)[source]
List Note 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
withFiles (bool) – whether to include files
- Returns:
List of Note objects
- Return type:
list