ADT
psengine.classic_alerts.classic_alert
¶
AlertRuleOut
¶
Bases: RFBaseModel
Validate data received from v2/alert/rule
.
model_config
class-attribute
instance-attribute
¶
json
¶
json(
by_alias: bool = True,
exclude_none: bool = True,
auto_exclude_unset: bool = True,
**kwargs,
)
JSON representation of models. It is inherited by every model.
PARAMETER | DESCRIPTION |
---|---|
by_alias
|
Alias flag:
TYPE:
|
exclude_none
|
Whether to exclude fields equal to None.
TYPE:
|
auto_exclude_unset
|
Whether to auto exclude values not set.
TYPE:
|
Source code in psengine/common_models.py
ClassicAlert
¶
Bases: RFBaseModel
Validate data received from the /v3/alerts/{id}
endpoint.
This class supports hashing, equality comparison, string representation, and total
ordering of ClassicAlert
instances.
Hashing
Returns a hash value based on the id_
.
Equality
Checks equality between two ClassicAlert
instances based on their id_
.
Greater-than Comparison
Defines a greater-than comparison between two ClassicAlert
instances based on their
log triggered timestamp.
String Representation
Returns a string representation of the ClassicAlert
instance including the id_
,
triggered timestamp, title, and alerting rule name.
Total ordering
The ordering of ClassicAlert
instances is determined primarily by the log triggered
timestamp. If two instances have the same triggered timestamp, their id_
is used as a
secondary criterion.
enriched_entities
class-attribute
instance-attribute
¶
enriched_entities: Optional[list[EnrichedEntity]] = None
images
property
¶
model_config
class-attribute
instance-attribute
¶
owner_organisation_details
class-attribute
instance-attribute
¶
owner_organisation_details: Optional[
OwnerOrganisationDetails
] = None
__eq__
¶
__eq__(other: ClassicAlert)
__gt__
¶
__gt__(other: ClassicAlert)
__hash__
¶
__str__
¶
json
¶
json(
by_alias: bool = True,
exclude_none: bool = True,
auto_exclude_unset: bool = True,
**kwargs,
)
JSON representation of models. It is inherited by every model.
PARAMETER | DESCRIPTION |
---|---|
by_alias
|
Alias flag:
TYPE:
|
exclude_none
|
Whether to exclude fields equal to None.
TYPE:
|
auto_exclude_unset
|
Whether to auto exclude values not set.
TYPE:
|
Source code in psengine/common_models.py
markdown
¶
markdown(
owner_org: bool = False,
ai_insights: bool = True,
fragment_entities: bool = True,
triggered_by: bool = True,
html_tags: bool = False,
character_limit: Optional[int] = None,
defang_iocs: bool = False,
) -> str
Return a markdown string representation of the ClassicAlert
instance.
PARAMETER | DESCRIPTION |
---|---|
owner_org
|
Include owner org details.
TYPE:
|
ai_insights
|
Include AI insights.
TYPE:
|
fragment_entities
|
Include fragment entities.
TYPE:
|
triggered_by
|
Include triggered by.
TYPE:
|
html_tags
|
Include HTML tags in the markdown.
TYPE:
|
character_limit
|
Character limit for the markdown.
TYPE:
|
defang_iocs
|
Defang IOCs in hits.
TYPE:
|
Note
This function works on ClassicAlert
instances returned by ClassicAlertMgr.fetch()
.
If you are passing the result of ClassicAlertMgr.search()
, make sure the search
method has been called with all the fields. Keep in mind that this will make the
search
slower.
RAISES | DESCRIPTION |
---|---|
AlertMarkdownError
|
If fields are not available. |
RETURNS | DESCRIPTION |
---|---|
str
|
Markdown representation of the alert. |
Source code in psengine/classic_alerts/classic_alert.py
parse_trigger_by
classmethod
¶
Parse a list of data dictionaries to extract and format entity paths.
Each entity path is transformed into a formatted string where each entity is represented as
EntityName (EntityType)
, joined by ->
.
If an entity's type is MetaType
, it is formatted as Any EntityName
instead.
Example:
PARAMETER | DESCRIPTION |
---|---|
data
|
List of dicts, each containing a
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
list[dict]
|
List of dicts with |
Source code in psengine/classic_alerts/classic_alert.py
store_image
¶
Store the image ID and image bytes in the @images
dictionary.
Example:
PARAMETER | DESCRIPTION |
---|---|
image_id
|
The image ID.
TYPE:
|
image_bytes
|
The image bytes.
TYPE:
|
Source code in psengine/classic_alerts/classic_alert.py
triggered_by_from_hit
¶
triggered_by_from_hit(hit: ClassicAlertHit) -> list[str]
From an Alert Hit block, returns the related Triggered By string representation.