# kadetron/vulnex architecture

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

- Interactive diagram: https://gitdiagram.com/kadetron/vulnex
- Repository: https://github.com/kadetron/vulnex

## Overview

##### Project type and purpose
- Vulnex is a small command-line security scanning tool.
- Its job is to crawl a given domain (depth = 2), find all “.php” endpoints, append SQL-injection test payloads (`'` and `"`), issue HTTP requests, and detect SQL errors in the responses.

##### File structure
- Top-level:
- LICENSE – license terms
- README.md – usage, features, dependencies
- vulnex – the single executable script (likely a Bash shell script)
- No separate source folders—everything lives in one script.
- External dependencies invoked by the script: `curl`, `grep`, `sed`, `awk`, `uniq`.

##### README for additional insights
- Usage is purely CLI (`vulnex [domain]`).
- There’s no database or persistent storage—everything is in-memory during a run.
- No external web services beyond HTTP GET requests to the target domain.

1. CLI Frontend
- Parses user args (domain, flags).
2. Crawler (Scraping Engine)
- Uses `curl` to fetch HTML up to depth 2.
- Uses `grep`/`sed`/`awk` to extract links.
- Filters unique “.php” URLs (`uniq`).
3. Payload Generator
- Takes each URL, constructs two variants (+ `'`, + `"`).
4. Scanner (HTTP Tester)
- Issues HTTP requests for each payload via `curl`.
5. Response Parser
- Uses `grep`/`sed` to scan for SQL error patterns.
6. Result Aggregator & Reporter
- Collects vulnerable URLs and prints to stdout.
7. External Dependencies

- User → CLI Frontend
- CLI Frontend → Crawler
- Crawler → Payload Generator
- Payload Generator → Scanner
- Scanner → Response Parser
- Response Parser → Result Aggregator
- Result Aggregator → User (console output)

c. Architectural patterns & design principles
- Single-process pipeline (modular stages).
- Streaming data flow (URL list → payloads → scan results).
- Unix-style filters: each stage uses small tools specializing in one function.

d. Key technologies/frameworks
- Shell script (bash) glue logic
- curl (HTTP client)
- grep/sed/awk (text processing)
- uniq (deduplication)

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Pipeline components
    subgraph "Vulnex Pipeline"
        CLI["CLI Frontend\n(parse args)"]:::internal
        Crawler["Crawler\n(curl + grep + sed + awk)"]:::internal
        Payload["Payload Generator"]:::internal
        Scanner["Scanner\n(curl)"]:::internal
        Parser["Response Parser\n(grep + sed)"]:::internal
        Aggregator["Result Aggregator\n(stdout)"]:::internal
    end

    %% External Dependencies
    subgraph "External Dependencies"
        curl["curl"]:::external
        grep["grep"]:::external
        sed["sed"]:::external
        awk["awk"]:::external
        uniq["uniq"]:::external
    end

    %% Documentation
    subgraph "Project Documentation"
        README["README.md"]:::docs
        LICENSE["LICENSE"]:::docs
    end

    %% Data flow
    User((User)):::actor
    User ---|"execute"| CLI
    CLI -->|"domain"| Crawler
    Crawler -->|".php URLs"| Payload
    Payload -->|"payload URLs"| Scanner
    Scanner -->|"HTTP responses"| Parser
    Parser -->|"error matches"| Aggregator
    Aggregator -->|"report"| User

    %% Dependencies
    Crawler --> curl
    Crawler --> grep
    Crawler --> sed
    Crawler --> awk
    Crawler --> uniq
    Scanner --> curl
    Parser --> grep
    Parser --> sed

    %% Click events
    click CLI "https://github.com/kadetron/vulnex/tree/main/vulnex"
    click Crawler "https://github.com/kadetron/vulnex/tree/main/vulnex"
    click Payload "https://github.com/kadetron/vulnex/tree/main/vulnex"
    click Scanner "https://github.com/kadetron/vulnex/tree/main/vulnex"
    click Parser "https://github.com/kadetron/vulnex/tree/main/vulnex"
    click Aggregator "https://github.com/kadetron/vulnex/tree/main/vulnex"
    click README "https://github.com/kadetron/vulnex/blob/main/README.md"
    click LICENSE "https://github.com/kadetron/vulnex/tree/main/LICENSE"

    %% Styling
    classDef internal fill:#ADD8E6,stroke:#333,stroke-width:1px
    classDef external fill:#D3D3D3,stroke:#333,stroke-width:1px
    classDef docs fill:#90EE90,stroke:#333,stroke-width:1px
    classDef actor fill:#FFF,stroke:#333,stroke-width:1px,stroke-dasharray: 5 5
```
