Skip to content

Base STIX Entity

psengine.stix2.base_stix_entity

BaseStixEntity

BaseStixEntity(name: str, author: Identity = None)

Base STIX entity class for Recorded Future entities.

PARAMETER DESCRIPTION
name

The name of the entity.

TYPE: str

author

A Recorded Future Identity object.

TYPE: Identity DEFAULT: None

Source code in psengine/stix2/base_stix_entity.py
def __init__(
    self,
    name: Annotated[str, Doc('The name of the entity.')],
    author: Annotated[stix2.Identity, Doc('A Recorded Future Identity object.')] = None,
) -> None:
    """Initializes base STIX entity."""
    self.name = name
    if not author:
        author = self._create_author()
    self.author = author
    self.stix_obj = None
    self.create_stix_object()

author instance-attribute

author = author

name instance-attribute

name = name

stix_obj instance-attribute

stix_obj = None

__eq__

__eq__(other) -> bool

Verify if two STIX Objects are the same.

Source code in psengine/stix2/base_stix_entity.py
def __eq__(self, other) -> bool:
    """Verify if two STIX Objects are the same."""
    return self._generate_id() == other._generate_id()

__hash__

__hash__() -> int

Hash for set function.

Source code in psengine/stix2/base_stix_entity.py
def __hash__(self) -> int:
    """Hash for set function."""
    return hash(self._generate_id())

__str__

__str__() -> str

String representation of entity.

Source code in psengine/stix2/base_stix_entity.py
def __str__(self) -> str:
    """String representation of entity."""
    return f'Base STIX Entity: {self.name}, Author Name: {self.author.name}'

create_stix_object

create_stix_object() -> None

Creates STIX objects from object attributes.

Source code in psengine/stix2/base_stix_entity.py
def create_stix_object(self) -> None:
    """Creates STIX objects from object attributes."""