# cr0nica1/p2o-bot-updater architecture

> Architecture diagram of the GitHub repository cr0nica1/p2o-bot-updater, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-06). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/cr0nica1/p2o-bot-updater
- Repository: https://github.com/cr0nica1/p2o-bot-updater

## Overview

Pwn2Own Target Updater is a Discord bot and CLI for managing target records, collecting vulnerability and firmware/version information, and presenting search results or scheduled notifications. The main workflow enters through Discord commands, which dispatch application use cases; those use repositories and external-source/browser adapters, with MongoDB as persistent storage. The README documents additional target import, vendor configuration, export, and scheduled workflows. Some of those implementation paths were not excerpted, so their documented links are marked unverified rather than inferred from module names.

Main entry points: [`src/updater/presentation/discord_bot/commands.py`](https://github.com/cr0nica1/p2o-bot-updater/blob/master/src/updater/presentation/discord_bot/commands.py) (Slash commands), [`src/updater/presentation/discord_bot/bot.py`](https://github.com/cr0nica1/p2o-bot-updater/blob/master/src/updater/presentation/discord_bot/bot.py) (Discord bot), [`src/updater/application/firmware_lookup.py`](https://github.com/cr0nica1/p2o-bot-updater/blob/master/src/updater/application/firmware_lookup.py) (Firmware lookup), [`src/updater/application/sync_vulnerabilities.py`](https://github.com/cr0nica1/p2o-bot-updater/blob/master/src/updater/application/sync_vulnerabilities.py) (Vulnerability sync)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_presentation["User interfaces"]
  node_discord_bot["Discord bot<br/>[bot.py]"]
  node_commands["Slash commands<br/>[commands.py]"]
  node_bot_config["Bot configuration<br/>[config.py]"]
  node_formatting["Response formatting<br/>[formatting.py]"]
  node_scheduler["Job scheduler<br/>[scheduler.py]"]
  node_firmware_cli["Firmware CLI<br/>[firmware_lookup.py]"]
  node_vendor_cli["Vendor config CLI<br/>[vendor_config.py]"]
end

subgraph group_application["Application use cases"]
  node_vuln_sync["Vulnerability sync"]
  node_firmware_lookup["Firmware lookup<br/>[firmware_lookup.py]"]
  node_version_scan["Version scan<br/>[version_scan.py]"]
  node_target_import["Target CSV import<br/>[import_targets.py]"]
  node_json_export["JSON export<br/>[export_json.py]"]
  node_purge["Chroma purge<br/>[purge_chroma.py]"]
end

subgraph group_infrastructure["Adapters and storage"]
  node_mongo[("MongoDB repositories<br/>[mongo.py]")]
  node_csv_loader["CSV loader<br/>[csv_loader.py]"]
  node_json_exporter["JSON output<br/>[json_exporter.py]"]
  node_nvd["NVD source<br/>[nvd.py]"]
  node_zdi["ZDI source<br/>[zdi.py]"]
  node_browser["Browser adapter<br/>[cloak.py]"]
  node_http_fetch["HTTP fetch adapter<br/>[http_fetch.py]"]
  node_seed["Version-check seed<br/>[version_checks.py]"]
end

subgraph group_domain["Domain model"]
  node_domain_models["Domain records<br/>[models.py]"]
  node_repo_protocols["Repository protocols<br/>[repositories.py]"]
end

node_discord_user(("Discord user"))
node_cli_user(("CLI user"))
node_discord(("Discord service"))
node_mongodb_service[("MongoDB service")]
node_nvd_service(("NIST NVD"))
node_zdi_service(("ZDI advisories"))
node_vendor_pages(("Vendor web pages"))

node_discord_user -->|"invokes"| node_discord_bot
node_discord_bot -->|"dispatches"| node_commands
node_commands -->|"runs sync"| node_vuln_sync
node_commands -->|"runs lookup"| node_firmware_lookup
node_commands -->|"runs scan"| node_version_scan
node_commands -->|"imports targets"| node_target_import
node_commands -->|"exports data"| node_json_export
node_discord_bot -->|"loads settings"| node_bot_config
node_discord_bot -->|"formats replies"| node_formatting
node_discord_bot -->|"runs scheduled jobs"| node_scheduler
node_discord_bot -->|"connects to"| node_discord
node_cli_user -->|"invokes"| node_firmware_cli
node_cli_user -->|"invokes"| node_vendor_cli
node_firmware_cli -->|"runs lookup"| node_firmware_lookup
node_vendor_cli -->|"manages config"| node_mongo
node_vuln_sync -->|"queries source"| node_nvd
node_vuln_sync -->|"queries source"| node_zdi
node_nvd -->|"fetches advisories"| node_nvd_service
node_zdi -->|"fetches advisories"| node_zdi_service
node_firmware_lookup -->|"fetches page content"| node_browser
node_firmware_lookup -->|"optionally fetches"| node_http_fetch
node_browser -->|"loads page"| node_vendor_pages
node_http_fetch -.->|"fetches page"| node_vendor_pages
node_target_import -.->|"loads CSV"| node_csv_loader
node_json_export -.->|"writes JSON"| node_json_exporter
node_vuln_sync -.->|"persists records"| node_mongo
node_firmware_lookup -.->|"reads target config"| node_mongo
node_version_scan -.->|"stores versions"| node_mongo
node_mongo -->|"reads and writes"| node_mongodb_service
node_vuln_sync -->|"builds domain records"| node_domain_models
node_firmware_lookup -->|"uses target config"| node_domain_models
node_repo_protocols -->|"specifies records"| node_domain_models
node_seed -->|"seeds version checks"| node_domain_models
node_scheduler -.->|"schedules daily scan"| node_version_scan
node_commands -.->|"clears Chroma data"| node_purge

click node_discord_bot "https://github.com/cr0nica1/p2o-bot-updater/blob/master/src/updater/presentation/discord_bot/bot.py"
click node_commands "https://github.com/cr0nica1/p2o-bot-updater/blob/master/src/updater/presentation/discord_bot/commands.py"
click node_bot_config "https://github.com/cr0nica1/p2o-bot-updater/blob/master/src/updater/presentation/discord_bot/config.py"
click node_formatting "https://github.com/cr0nica1/p2o-bot-updater/blob/master/src/updater/presentation/discord_bot/formatting.py"
click node_scheduler "https://github.com/cr0nica1/p2o-bot-updater/blob/master/src/updater/presentation/discord_bot/scheduler.py"
click node_firmware_cli "https://github.com/cr0nica1/p2o-bot-updater/blob/master/src/updater/cli/firmware_lookup.py"
click node_vendor_cli "https://github.com/cr0nica1/p2o-bot-updater/blob/master/src/updater/cli/vendor_config.py"
click node_vuln_sync "https://github.com/cr0nica1/p2o-bot-updater/blob/master/src/updater/application/sync_vulnerabilities.py"
click node_firmware_lookup "https://github.com/cr0nica1/p2o-bot-updater/blob/master/src/updater/application/firmware_lookup.py"
click node_version_scan "https://github.com/cr0nica1/p2o-bot-updater/blob/master/src/updater/application/version_scan.py"
click node_target_import "https://github.com/cr0nica1/p2o-bot-updater/blob/master/src/updater/application/import_targets.py"
click node_json_export "https://github.com/cr0nica1/p2o-bot-updater/blob/master/src/updater/application/export_json.py"
click node_purge "https://github.com/cr0nica1/p2o-bot-updater/blob/master/src/updater/application/purge_chroma.py"
click node_mongo "https://github.com/cr0nica1/p2o-bot-updater/blob/master/src/updater/infrastructure/mongo.py"
click node_csv_loader "https://github.com/cr0nica1/p2o-bot-updater/blob/master/src/updater/infrastructure/csv_loader.py"
click node_json_exporter "https://github.com/cr0nica1/p2o-bot-updater/blob/master/src/updater/infrastructure/json_exporter.py"
click node_nvd "https://github.com/cr0nica1/p2o-bot-updater/blob/master/src/updater/infrastructure/sources/nvd.py"
click node_zdi "https://github.com/cr0nica1/p2o-bot-updater/blob/master/src/updater/infrastructure/sources/zdi.py"
click node_browser "https://github.com/cr0nica1/p2o-bot-updater/blob/master/src/updater/infrastructure/browser/cloak.py"
click node_http_fetch "https://github.com/cr0nica1/p2o-bot-updater/blob/master/src/updater/infrastructure/browser/http_fetch.py"
click node_seed "https://github.com/cr0nica1/p2o-bot-updater/blob/master/src/updater/infrastructure/seed/version_checks.py"
click node_domain_models "https://github.com/cr0nica1/p2o-bot-updater/blob/master/src/updater/domain/models.py"
click node_repo_protocols "https://github.com/cr0nica1/p2o-bot-updater/blob/master/src/updater/domain/repositories.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_discord_bot,node_commands,node_bot_config,node_formatting,node_scheduler,node_firmware_cli,node_vendor_cli,node_discord_user,node_cli_user toneBlue
class node_vuln_sync,node_firmware_lookup,node_version_scan,node_target_import,node_json_export,node_purge,node_mongodb_service toneAmber
class node_mongo,node_csv_loader,node_json_exporter,node_nvd,node_zdi,node_browser,node_http_fetch,node_seed toneMint
class node_domain_models,node_repo_protocols toneRose
class node_discord,node_nvd_service,node_zdi_service,node_vendor_pages toneIndigo
```

## Components

### User interfaces

- [Discord bot](https://github.com/cr0nica1/p2o-bot-updater/blob/master/src/updater/presentation/discord_bot/bot.py): `src/updater/presentation/discord_bot/bot.py`
- [Slash commands](https://github.com/cr0nica1/p2o-bot-updater/blob/master/src/updater/presentation/discord_bot/commands.py): `src/updater/presentation/discord_bot/commands.py`
- [Bot configuration](https://github.com/cr0nica1/p2o-bot-updater/blob/master/src/updater/presentation/discord_bot/config.py): `src/updater/presentation/discord_bot/config.py`
- [Response formatting](https://github.com/cr0nica1/p2o-bot-updater/blob/master/src/updater/presentation/discord_bot/formatting.py): `src/updater/presentation/discord_bot/formatting.py`
- [Job scheduler](https://github.com/cr0nica1/p2o-bot-updater/blob/master/src/updater/presentation/discord_bot/scheduler.py): `src/updater/presentation/discord_bot/scheduler.py`
- [Firmware CLI](https://github.com/cr0nica1/p2o-bot-updater/blob/master/src/updater/cli/firmware_lookup.py): `src/updater/cli/firmware_lookup.py`
- [Vendor config CLI](https://github.com/cr0nica1/p2o-bot-updater/blob/master/src/updater/cli/vendor_config.py): `src/updater/cli/vendor_config.py`

### Application use cases

- [Vulnerability sync](https://github.com/cr0nica1/p2o-bot-updater/blob/master/src/updater/application/sync_vulnerabilities.py): `src/updater/application/sync_vulnerabilities.py`
- [Firmware lookup](https://github.com/cr0nica1/p2o-bot-updater/blob/master/src/updater/application/firmware_lookup.py): `src/updater/application/firmware_lookup.py`
- [Version scan](https://github.com/cr0nica1/p2o-bot-updater/blob/master/src/updater/application/version_scan.py): `src/updater/application/version_scan.py`
- [Target CSV import](https://github.com/cr0nica1/p2o-bot-updater/blob/master/src/updater/application/import_targets.py): `src/updater/application/import_targets.py`
- [JSON export](https://github.com/cr0nica1/p2o-bot-updater/blob/master/src/updater/application/export_json.py): `src/updater/application/export_json.py`
- [Chroma purge](https://github.com/cr0nica1/p2o-bot-updater/blob/master/src/updater/application/purge_chroma.py): `src/updater/application/purge_chroma.py`

### Adapters and storage

- [MongoDB repositories](https://github.com/cr0nica1/p2o-bot-updater/blob/master/src/updater/infrastructure/mongo.py): `src/updater/infrastructure/mongo.py`
- [CSV loader](https://github.com/cr0nica1/p2o-bot-updater/blob/master/src/updater/infrastructure/csv_loader.py): `src/updater/infrastructure/csv_loader.py`
- [JSON output](https://github.com/cr0nica1/p2o-bot-updater/blob/master/src/updater/infrastructure/json_exporter.py): `src/updater/infrastructure/json_exporter.py`
- [NVD source](https://github.com/cr0nica1/p2o-bot-updater/blob/master/src/updater/infrastructure/sources/nvd.py): `src/updater/infrastructure/sources/nvd.py`
- [ZDI source](https://github.com/cr0nica1/p2o-bot-updater/blob/master/src/updater/infrastructure/sources/zdi.py): `src/updater/infrastructure/sources/zdi.py`
- [Browser adapter](https://github.com/cr0nica1/p2o-bot-updater/blob/master/src/updater/infrastructure/browser/cloak.py): `src/updater/infrastructure/browser/cloak.py`
- [HTTP fetch adapter](https://github.com/cr0nica1/p2o-bot-updater/blob/master/src/updater/infrastructure/browser/http_fetch.py): `src/updater/infrastructure/browser/http_fetch.py`
- [Version-check seed](https://github.com/cr0nica1/p2o-bot-updater/blob/master/src/updater/infrastructure/seed/version_checks.py): `src/updater/infrastructure/seed/version_checks.py`

### Domain model

- [Domain records](https://github.com/cr0nica1/p2o-bot-updater/blob/master/src/updater/domain/models.py): `src/updater/domain/models.py`
- [Repository protocols](https://github.com/cr0nica1/p2o-bot-updater/blob/master/src/updater/domain/repositories.py): `src/updater/domain/repositories.py`

### Other components

- **Discord user**
- **CLI user**
- **Discord service**
- **MongoDB service**
- **NIST NVD**
- **ZDI advisories**
- **Vendor web pages**

## Connections

- Discord user → Discord bot: invokes (evidence: `README.md`)
- Discord bot → Slash commands: dispatches (evidence: `src/updater/presentation/discord_bot/bot.py`)
- Slash commands → Vulnerability sync: runs sync (evidence: `src/updater/presentation/discord_bot/commands.py`)
- Slash commands → Firmware lookup: runs lookup (evidence: `src/updater/presentation/discord_bot/commands.py`)
- Slash commands → Version scan: runs scan (evidence: `src/updater/presentation/discord_bot/commands.py`)
- Slash commands → Target CSV import: imports targets (evidence: `src/updater/presentation/discord_bot/commands.py`)
- Slash commands → JSON export: exports data (evidence: `src/updater/presentation/discord_bot/commands.py`)
- Discord bot → Bot configuration: loads settings (evidence: `src/updater/presentation/discord_bot/bot.py`)
- Discord bot → Response formatting: formats replies (evidence: `src/updater/presentation/discord_bot/bot.py`)
- Discord bot → Job scheduler: runs scheduled jobs (evidence: `src/updater/presentation/discord_bot/bot.py`)
- Discord bot → Discord service: connects to (evidence: `README.md`)
- CLI user → Firmware CLI: invokes (evidence: `README.md`)
- CLI user → Vendor config CLI: invokes (evidence: `README.md`)
- Firmware CLI → Firmware lookup: runs lookup (evidence: `src/updater/cli/firmware_lookup.py`)
- Vendor config CLI → MongoDB repositories: manages config (evidence: `src/updater/cli/vendor_config.py`)
- Vulnerability sync → NVD source: queries source (evidence: `README.md`)
- Vulnerability sync → ZDI source: queries source (evidence: `README.md`)
- NVD source → NIST NVD: fetches advisories (evidence: `README.md`)
- ZDI source → ZDI advisories: fetches advisories (evidence: `src/updater/infrastructure/sources/zdi.py`)
- Firmware lookup → Browser adapter: fetches page content (evidence: `src/updater/application/firmware_lookup.py`)
- Firmware lookup → HTTP fetch adapter: optionally fetches (evidence: `src/updater/application/firmware_lookup.py`)
- Browser adapter → Vendor web pages: loads page (evidence: `src/updater/infrastructure/browser/cloak.py`)
- HTTP fetch adapter → Vendor web pages: fetches page
- Target CSV import → CSV loader: loads CSV
- JSON export → JSON output: writes JSON
- Vulnerability sync → MongoDB repositories: persists records
- Firmware lookup → MongoDB repositories: reads target config
- Version scan → MongoDB repositories: stores versions
- MongoDB repositories → MongoDB service: reads and writes (evidence: `README.md`)
- Vulnerability sync → Domain records: builds domain records (evidence: `src/updater/application/sync_vulnerabilities.py`)
- Firmware lookup → Domain records: uses target config (evidence: `src/updater/application/firmware_lookup.py`)
- Repository protocols → Domain records: specifies records (evidence: `src/updater/domain/repositories.py`)
- Version-check seed → Domain records: seeds version checks (evidence: `src/updater/infrastructure/seed/version_checks.py`)
- Job scheduler → Version scan: schedules daily scan
- Slash commands → Chroma purge: clears Chroma data
