MCPcopy Create free account
hub / github.com/blacklanternsecurity/bbot / Event

Class Event

bbot/db/sql/models.py:71–116  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

69
70
71class Event(BBOTBaseModel, table=True):
72 def __init__(self, *args, **kwargs):
73 super().__init__(*args, **kwargs)
74 data = self._get_data(self.data, self.type)
75 self.data = {self.type: data}
76 if self.host:
77 self.reverse_host = self.host[::-1]
78
79 def get_data(self):
80 return self._get_data(self.data, self.type)
81
82 @staticmethod
83 def _get_data(data, type):
84 # handle SIEM-friendly format
85 if isinstance(data, dict) and list(data) == [type]:
86 return data[type]
87 return data
88
89 uuid: str = Field(
90 primary_key=True,
91 index=True,
92 nullable=False,
93 )
94 id: str = Field(index=True)
95 type: str = Field(index=True)
96 scope_description: str
97 data: dict = Field(sa_type=JSON)
98 host: Optional[str]
99 port: Optional[int]
100 netloc: Optional[str]
101 # store the host in reversed form for efficient lookups by domain
102 reverse_host: Optional[str] = Field(default="", exclude=True, index=True)
103 resolved_hosts: List = Field(default=[], sa_type=JSON)
104 dns_children: dict = Field(default={}, sa_type=JSON)
105 web_spider_distance: int = 10
106 scope_distance: int = Field(default=10, index=True)
107 scan: str = Field(index=True)
108 timestamp: NaiveUTC = Field(index=True)
109 parent: str = Field(index=True)
110 tags: List = Field(default=[], sa_type=JSON)
111 module: str = Field(index=True)
112 module_sequence: str
113 discovery_context: str = ""
114 discovery_path: List[str] = Field(default=[], sa_type=JSON)
115 parent_chain: List[str] = Field(default=[], sa_type=JSON)
116 inserted_at: NaiveUTC = Field(default_factory=lambda: datetime.now(timezone.utc))
117
118
119### SCAN ###

Callers 1

handle_eventMethod · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…