# 0xsojalsec/wpprobe architecture

> Architecture diagram of the GitHub repository 0xsojalsec/wpprobe, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-03-28). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/0xsojalsec/wpprobe
- Repository: https://github.com/0xsojalsec/wpprobe

## Overview

##### Main Components
- CLI Interface & Command Handling:
- Entry point (main.go) along with the commands located under the “cmd” directory (e.g., scan, update, uninstall, and db commands). These constitute the user-facing interface that accepts command-line arguments.
- Scanning Engine:
- In the “internal/scanner” directory, include modules for scanning logic, such as discovering REST endpoints, matching plugin signatures, and performing the actual analysis.
- Utility & Helper Modules:
- In “internal/utils”, include components for common functions like file handling, HTTP requests, progress bar updates, logging, and version control.
- Vulnerability Database Module:
- CI/CD & Build/Deployment:
- Existence of GitHub workflows (.github/workflows) for building and releasing (Go CI, release workflows). Also note the Dockerfile for containerizing the tool along with .goreleaser.yaml for release automation.

##### How the Components Interact
- User Inputs & CLI Processing:
- Command Execution Flow:
- For scanning commands: show that the command handler calls the “Scanner Engine” to initiate the plugin scan, which in turn utilizes utilities (HTTP, file, etc.) from the “Utils” module.
- External Communication:
- You may also include a note how the tool fetches vulnerability data and correlates detected plugins with known CVEs.

##### Architectural Patterns and Design Principles
- Modularity:
- That the project is organized in distinct modules (cmd, internal/scanner, internal/utils, internal/wordfence) – which supports separation of concerns and ease of testing.
- Concurrency and Efficiency:
- Extensibility:
- Potential for easy extension (adding more scanning or fingerprinting techniques) by modularizing components.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Global Components
    U("User/Terminal"):::ui

    %% CLI Interface Subgraph
    subgraph "CLI Interface"
        M("main.go"):::cli
        C("cmd/ (scan.go,update.go,uninstall.go,db.go)"):::cli
    end

    %% Core Modules Subgraph
    subgraph "Core Modules"
        SE("Scanning Engine (internal/scanner)"):::logic
        UT("Utilities & Helpers (internal/utils)"):::logic
        WD("Vulnerability DB Updater (internal/wordfence)"):::logic
    end

    %% External dependencies and Output
    E("External WordPress Sites"):::external
    O("Output (CSV/JSON)"):::output

    %% CI/CD Pipeline Subgraph
    subgraph "CI/CD Pipeline"
        WF("GitHub Workflows (.github/workflows)"):::cicd
        D("Dockerfile"):::cicd
        GR("GoReleaser (.goreleaser.yaml)"):::cicd
    end

    %% Concurrency Note
    Note("ConcurrencyModel:MultithreadedScanning"):::note

    %% Connections
    U -->|"sendsCommand"| M
    U -->|"sendsCommand"| C
    M -->|"triggersScan"| SE
    C -->|"triggersScan"| SE
    M -->|"triggersUpdate"| WD
    C -->|"triggersUpdate"| WD
    SE -->|"usesUtilities"| UT
    SE -->|"HTTPcalls"| E
    SE -->|"produces"| O
    Note --- SE
    WF -->|"builddeploy"| M

    %% Click Events
    click M "https://github.com/0xsojalsec/wpprobe/blob/main/main.go"
    click C "https://github.com/0xsojalsec/wpprobe/tree/main/cmd/"
    click SE "https://github.com/0xsojalsec/wpprobe/tree/main/internal/scanner/"
    click UT "https://github.com/0xsojalsec/wpprobe/tree/main/internal/utils/"
    click WD "https://github.com/0xsojalsec/wpprobe/tree/main/internal/wordfence/"
    click WF "https://github.com/0xsojalsec/wpprobe/tree/main/.github/workflows/"
    click D "https://github.com/0xsojalsec/wpprobe/tree/main/Dockerfile"
    click GR "https://github.com/0xsojalsec/wpprobe/blob/main/.goreleaser.yaml"

    %% Styling
    classDef ui fill:#d4e157,stroke:#333,stroke-width:2px;
    classDef cli fill:#81d4fa,stroke:#333,stroke-width:2px;
    classDef logic fill:#a5d6a7,stroke:#333,stroke-width:2px;
    classDef external fill:#ffab91,stroke:#333,stroke-width:2px;
    classDef cicd fill:#ce93d8,stroke:#333,stroke-width:2px;
    classDef output fill:#fff176,stroke:#333,stroke-width:2px;
    classDef note fill:#e0e0e0,stroke:#333,stroke-dasharray: 5 5,stroke-width:2px;
```
