Edge
- class bhopengraph.Edge.Edge(start_node, end_node, kind, properties=None, start_match_by='id', end_match_by='id')[source]
Bases:
objectEdge class representing a directed edge in the OpenGraph.
Follows BloodHound OpenGraph schema requirements with start/end nodes, kind, and properties. All edges are directed and one-way as per BloodHound requirements.
Sources: - https://bloodhound.specterops.io/opengraph/schema#edges - https://bloodhound.specterops.io/opengraph/schema#minimal-working-json
- Parameters:
- __init__(start_node, end_node, kind, properties=None, start_match_by='id', end_match_by='id')[source]
Initialize an Edge.
- set_property(key, value)[source]
Set a property on the edge.
- Parameters:
key (-) – Property name
value (-) – Property value
- get_property(key, default=None)[source]
Get a property from the edge.
- Parameters:
key (-) – Property name
default (-) – Default value if property doesn’t exist
- Returns:
Property value or default
- remove_property(key)[source]
Remove a property from the edge.
- Parameters:
key (-) – Property name to remove
- to_dict()[source]
Convert edge to dictionary for JSON serialization.
- Returns:
Edge as dictionary following BloodHound OpenGraph schema
- Return type:
dict
- classmethod from_dict(edge_data)[source]
Create an Edge instance from a dictionary.
- Parameters:
edge_data (-) – Dictionary containing edge data
- Returns:
Edge instance or None if data is invalid
- Return type:
Edge
- get_unique_id()[source]
Get a unique ID for the edge.
- Returns:
Unique ID for the edge
- Return type:
str
- __eq__(other)[source]
Check if two edges are equal based on their start, end, and kind.
- Parameters:
other (-) – The other edge to compare to
- Returns:
True if the edges are equal, False otherwise
- Return type:
bool