Skip to content

Simple Entity

psengine.stix2.simple_entity

Identity

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

Bases: BaseStixEntity

Converts various RF entity types to a STIX2 Identity.

PARAMETER DESCRIPTION
name

The name of the identity.

TYPE: str

rf_type

The Recorded Future type of the identity.

TYPE: str

author

A Recorded Future author object.

TYPE: str DEFAULT: None

Source code in psengine/stix2/simple_entity.py
def __init__(
    self,
    name: Annotated[str, Doc('The name of the identity.')],
    rf_type: Annotated[str, Doc('The Recorded Future type of the identity.')],
    author: Annotated[str, Doc('A Recorded Future author object.')] = None,
) -> None:
    """Init Identity Class."""
    self.rf_type = rf_type
    super().__init__(name, author)

author instance-attribute

author = author

name instance-attribute

name = name

rf_type instance-attribute

rf_type = rf_type

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_id_class

create_id_class()

Creates a STIX2 identity class.

Source code in psengine/stix2/simple_entity.py
def create_id_class(self):
    """Creates a STIX2 identity class."""
    return IDENTITY_TYPE_TO_CLASS[self.rf_type]

create_stix_object

create_stix_object() -> None

Creates STIX objects from object attributes.

Source code in psengine/stix2/simple_entity.py
def create_stix_object(self) -> None:
    """Creates STIX objects from object attributes."""
    self.stix_obj = stix2.Identity(
        id=self._generate_id(),
        name=self.name,
        identity_class=self.create_id_class(),
        created_by_ref=self.author.id,
    )

IntrusionSet

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

Bases: BaseStixEntity

Converts Threat Actor to Intrusion Set SDO.

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/simple_entity.py
def create_stix_object(self) -> None:
    """Creates STIX objects from object attributes."""
    self.stix_obj = stix2.IntrusionSet(
        id=self._generate_id(),
        name=self.name,
        created_by_ref=self.author.id,
    )

Malware

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

Bases: BaseStixEntity

Converts Malware to a Malware SDO.

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/simple_entity.py
def create_stix_object(self) -> None:
    """Creates STIX objects from object attributes."""
    self.stix_obj = stix2.Malware(
        id=self._generate_id(),
        name=self.name,
        is_family=False,
        created_by_ref=self.author.id,
    )

TTP

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

Bases: BaseStixEntity

Converts MITRE T codes to AttackPattern.

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 AttackPattern objects from object attributes.

Source code in psengine/stix2/simple_entity.py
def create_stix_object(self) -> None:
    """Creates AttackPattern objects from object attributes."""
    self.stix_obj = stix2.AttackPattern(
        id=self._generate_id(),
        name=self.name,
        created_by_ref=self.author.id,
        custom_properties={'x_mitre_id': self.name},
    )

ThreatActor

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

Bases: BaseStixEntity

Converts various RF Threat Actor Organization to a STIX2 Threat Actor.

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/simple_entity.py
def create_stix_object(self) -> None:
    """Creates STIX objects from object attributes."""
    self.stix_obj = stix2.ThreatActor(
        id=self._generate_id(),
        name=self.name,
        created_by_ref=self.author.id,
    )

Vulnerability

Vulnerability(
    name: str, description: str = None, author: str = None
)

Bases: BaseStixEntity

Converts a CyberVulnerability to a Vulnerability SDO.

PARAMETER DESCRIPTION
name

The name of the identity.

TYPE: str

description

A vulnerability description.

TYPE: str DEFAULT: None

author

A Recorded Future author object.

TYPE: str DEFAULT: None

Source code in psengine/stix2/simple_entity.py
def __init__(
    self,
    name: Annotated[str, Doc('The name of the identity.')],
    description: Annotated[str, Doc('A vulnerability description.')] = None,
    author: Annotated[str, Doc('A Recorded Future author object.')] = None,
) -> None:
    """Init Vulnerability Class."""
    self.description = description
    super().__init__(name, author)

author instance-attribute

author = author

description instance-attribute

description = description

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/simple_entity.py
def create_stix_object(self) -> None:
    """Creates STIX objects from object attributes."""
    self.stix_obj = stix2.Vulnerability(
        id=self._generate_id(),
        description=self.description,
        name=self.name,
        created_by_ref=self.author.id,
    )