You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
class Actor(Element):
"""An entity usually initiating actions.
Attributes:
port (int): Default TCP port for outgoing data flows.
protocol (str): Default network protocol for outgoing data flows.
data (list): List of pytm.Data objects in outgoing data flows.
inputs (list): List of incoming Dataflows.
outputs (list): List of outgoing Dataflows.
isAdmin (bool): Indicates if the actor is an administrator.
"""
port = varInt(-1, doc="Default TCP port for outgoing data flows")
protocol = varString("", doc="Default network protocol for outgoing data flows")
data = varData([], doc="pytm.Data object(s) in outgoing data flows")
inputs = varElements([], doc="incoming Dataflows")
outputs = varElements([], doc="outgoing Dataflows")
isAdmin = varBool(False)
def __init__(self, name, **kwargs):
"""
Initialize an Actor object.
Args:
name (str): The name of the actor.
**kwargs: Additional keyword arguments.
port (int): Default TCP port for outgoing data flows.
protocol (str): Default network protocol for outgoing data flows.
data (list): List of pytm.Data objects in outgoing data flows.
inputs (list): List of incoming Dataflows.
outputs (list): List of outgoing Dataflows.
isAdmin (bool): Indicates if the actor is an administrator.
"""
super().__init__(name, **kwargs)
TM._actors.append(self)
The CLI based development workflow using
./tm.py --list-elements+./tm.py --describe <element>is not convenient for threat model creation.An easier and more efficient workflow to work with model entities (this includes custom model entities) makes use of/depends on docstrings.
E.g. when using google docstring format the Actor class (docstring reference) +
__init__method (google format docstring reference) could be documented likeand would result IDE-wise in something like this:
ide_docstring_preview_support.webm