Python API
The generated API reference is intentionally limited to supported plugin and model extension surfaces. Search commands are documented separately because their public interface is argparse-based.
Crawler plugins
Base class for crawler plugins.
BaseCrawlerPlugin
Bases: ABC
Abstract base class for crawler plugins. Plugins should inherit from this and implement the run method.
Source code in crawlers/plugins/base.py
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 | |
create_finding(event, rule_name, description, severity='medium', mitre_tactic=None, mitre_technique=None)
Create a finding for an event. Checks for cooldown based on config before creating.
Source code in crawlers/plugins/base.py
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 | |
get_queryset(model_class=None, **filters)
Helper to get a queryset from the configured database.
Source code in crawlers/plugins/base.py
29 30 31 32 33 34 35 36 | |
run()
abstractmethod
Run the crawler logic. For daemon mode, should loop continuously. For scheduled, run once.
Source code in crawlers/plugins/base.py
20 21 22 23 24 25 26 27 | |
send_alerts(finding)
Send alerts for the finding using configured alerting plugins.
Source code in crawlers/plugins/base.py
61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 | |
Bases: Model
Model to store findings generated by crawlers.
Source code in crawlers/models.py
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 | |
actionable_statuses()
classmethod
Return statuses that require preservation of the linked event.
Source code in crawlers/models.py
16 17 18 19 20 21 22 23 | |
can_create_finding(event, rule_name, cooldown_seconds=None)
classmethod
Check if a finding can be created for the given event and rule within the cooldown period. Returns True if no recent finding exists, False otherwise.
Source code in crawlers/models.py
56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 | |
Agent plugins
Cross-platform host security posture inventory.
HostSecurityPosturePlugin
Collect stable host inventory and best-effort security-control state.
Portable data comes from Python and psutil. Small platform adapters add
firewall, disk-encryption, secure-boot, and endpoint-protection state when
the operating system exposes it. Missing tools or insufficient privileges
are represented as unknown instead of stopping the collector.
Source code in agent/plugins/host_security_posture_plugin.py
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 | |
collect_once(timestamp=None)
Collect and enqueue one posture snapshot or its component diffs.
Source code in agent/plugins/host_security_posture_plugin.py
527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 | |
LinuxSchedulersPlugin
Emit diffs for cron and systemd timers/services. Config: poll_interval (default 60).
Source code in agent/plugins/linux_schedulers_plugin.py
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 | |
MacOSLaunchdPlugin
Track LaunchAgents/LaunchDaemons; emit adds/removes/changes. Config: poll_interval (default 60).
Source code in agent/plugins/macos_launchd_plugin.py
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 | |
Cross-platform network exposure and connection telemetry.
NetworkSecurityPlugin
Report changes to Internet listeners and active connections.
The collector uses psutil's system-wide connection API so the same code runs on Windows, Linux, and macOS. Process details are best effort because operating-system permissions can prevent attribution for some sockets.
Source code in agent/plugins/network_security_plugin.py
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 | |
collect_once(timestamp=None)
Collect and enqueue one snapshot. Exposed for deterministic tests.
Source code in agent/plugins/network_security_plugin.py
241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 | |
Plugin process manager for agent plugins. Handles plugin lifecycle, authentication, and process management.
PluginProcessManager
Manage the lifecycle of plugin processes, including starting, stopping, and monitoring their status. Also manages the sender process for communicating with the indexer.
Source code in agent/plugins/plugin_process_manager.py
177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 | |
check_and_restart()
Check the status of child processes and restart them if they are not alive.
Source code in agent/plugins/plugin_process_manager.py
213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 | |
children_alive()
Check if child processes are alive.
Source code in agent/plugins/plugin_process_manager.py
237 238 239 240 241 242 243 244 245 | |
start()
Start the plugin process and the sender process.
Source code in agent/plugins/plugin_process_manager.py
196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 | |
stop()
Stop the plugin processes gracefully.
Source code in agent/plugins/plugin_process_manager.py
247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 | |
get_indexer_transport(indexer_cfg)
Return HTTP/WS schemes plus verification settings for the indexer.
Source code in agent/plugins/plugin_process_manager.py
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 | |
get_session_cookie(indexer_cfg, credentials)
Authenticate with indexer and return session cookie.
Source code in agent/plugins/plugin_process_manager.py
66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 | |
run_plugin(plugin_path, config, event_queue, stop_event)
Run a plugin given its path and config, managing its lifecycle.
Source code in agent/plugins/plugin_process_manager.py
43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 | |
sender_process(event_queue, indexer_cfg, credentials=None)
Send events to the indexer via WebSocket.
Source code in agent/plugins/plugin_process_manager.py
117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 | |
SysmonPlugin: Collects and reports system metrics at intervals.
SysmonPlugin
Collects system metrics at a configurable interval and sends them to event_queue. Config keys: - poll_interval: seconds between checks (default: 5.0)
Source code in agent/plugins/sysmon_plugin.py
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 | |
TailPlugin: Tails files and sends new lines to event_queue, handling log rotation.
TailPlugin
Tails one or more files, following log rotation by name. Sends new lines to event_queue. Config keys: - patterns: list of glob patterns or absolute paths - poll_interval: seconds between checks (default: 1.0)
Source code in agent/plugins/tail_plugin.py
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 | |
WatchdogPlugin: Monitors file system changes and sends events to event_queue.
WatchdogPlugin
Bases: PatternMatchingEventHandler
Monitor file system changes.
Source code in agent/plugins/watchdog_plugin.py
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 | |
WindowsEventLogPlugin: Monitors Windows Event Log and sends new events to event_queue based on level.
WindowsEventLogPlugin
Monitors Windows Event Log for new events above a configurable level. Sends events to event_queue. Config keys: - log_type: Event log type (e.g., 'System', 'Application', 'Security') (default: 'System') - level: Minimum level to index ('ERROR', 'WARNING', 'INFORMATION', 'AUDIT_SUCCESS', 'AUDIT_FAILURE') (default: 'ERROR') - poll_interval: seconds between checks (default: 10.0)
Source code in agent/plugins/windows_event_log_plugin.py
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 | |
WindowsScheduledTasksPlugin
Enumerate Scheduled Tasks and emit a snapshot + diffs. Config: poll_interval (sec, default 60).
Source code in agent/plugins/windows_scheduled_tasks_plugin.py
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 | |
Events
Models for the events app.
This module defines the Event model for storing indexed event data with metadata and extracted fields.
Event
Bases: Model
Model representing an indexed event.
Stores event data along with metadata like index, sourcetype, source, and host. Includes extracted fields for structured data access.
Source code in events/models.py
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 | |
__str__()
String representation of the event.
Returns a truncated view of the event metadata and data.
Source code in events/models.py
39 40 41 42 43 44 45 | |
save(*args, **kwargs)
Extract fields before the initial insert, keeping creation to one write.
Source code in events/models.py
33 34 35 36 37 | |
Event data extractors for the events app.
This module provides functions to determine sourcetypes and extract structured data from event raw data, such as JSON parsing.
apply_extractions(event)
Apply configured field extractions to an event without saving it.
The caller remains responsible for persisting the mutated event. Keeping
extraction separate from persistence lets both normal saves and
bulk_create perform exactly one database write.
Source code in events/extractors.py
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 | |
extract_json(event)
Extract JSON data from the event.
Parses the event's raw data as JSON.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
event
|
The event object containing JSON data. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
dict |
Parsed JSON data. |
Raises:
| Type | Description |
|---|---|
JSONDecodeError
|
If the data is not valid JSON. |
Source code in events/extractors.py
73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 | |
is_json_sourcetype(event)
Check if the event sourcetype is JSON.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
event
|
The event object to check. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
bool |
True if sourcetype is 'json', False otherwise. |
Source code in events/extractors.py
58 59 60 61 62 63 64 65 66 67 68 69 70 | |