# leebaird/discover architecture

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

- Interactive diagram: https://gitdiagram.com/leebaird/discover
- Repository: https://github.com/leebaird/discover

## Overview

##### Project type and purpose
- This is a modular, full-suite penetration-testing automation framework composed of Bash scripts.
- It orchestrates reconnaissance, scanning, enumeration, payload generation, listener setup, parsing, and report generation by invoking external tools (Nmap, Metasploit, Trivy, DNSRecon, etc.) on a Kali Linux host.

##### File structure
- Top-level “discover.sh” acts as the CLI launcher and menu controller.
- Discrete task scripts live alongside it (api-scanner.sh, domain.sh, listener.sh, etc.).
- “parsers/” contains Python scripts that transform XML/JSON from tools (Burp, Nessus, Nmap) into CSV.
- “resource/” holds Metasploit RC files for automated module execution.
- “config/” stores user and environment setup files.
- “report/” is the static site generator: assets (CSS, JS, fonts), data (HTML fragments), and pages.
- “misc/” provides assorted helper scripts and deployment templates (Ansible, Terraform).
- README describes major functional areas: RECON, SCANNING, WEB, MISC, DEV.

##### Key insights from the README
- A menu-driven CLI (discover.sh) dynamically invokes underlying modules.
- External dependencies: Nmap, Metasploit, Burp, DNSRecon, dnstwist, subfinder, etc., and cloud/container scanners (Trivy, Kubernetes APIs).
- Reports are generated as a local HTML site under “report/”.

##### Main components
a. CLI Frontend
- discover.sh (menu dispatcher)
- domain.sh, generateTargets.sh, cve.sh, etc.
b. Module Executors
- Recon modules (domain.sh, person.sh)
- Scanning modules (api-scanner.sh, web-api-scanner.sh, ssl.sh, nikto.sh, waf-detect.sh, etc.)
- Payload modules (payload.sh, msf-aux.sh)
- Dev security scanners (container-scanner.sh, cloud-scanner.sh, oauth-jwt-scanner.sh)
c. Parsers
- Python scripts in “parsers/”
d. Resource Store
- Metasploit RC files in “resource/”
e. Configuration
- dotfiles and installer in “config/”
f. External Tools & Services
- Nmap, Metasploit, Burp, Trivy, DNSRecon, shodan, cloud APIs, Kubernetes API
g. Report Generator
- report.sh and the static directory under “report/”

##### Relationships and data flows
- User invokes discover.sh → presents menu → user selects task → discover.sh calls the corresponding module script.
- Module script invokes external tool or calls parser, passing input/output file paths.
- Parsers transform tool output into CSV/HTML fragments.
- Resource files (Metasploit RC) are fed into Metasploit console.
- Final report.sh assembles data fragments into the “report/” directory, producing a self-contained HTML site.
- Config files and environment variables are loaded at startup.

##### Architectural patterns and design principles
- Plugin pattern: each task is a standalone script that conforms to a common menu-driven interface.
- Separation of concerns: reconnaissance, scanning, parsing, report generation are distinct layers.
- Convention-based configuration: “config/” for user settings, API keys, environment tweaks.
- Static site generation for reports (no database).

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% CLI Frontend
    subgraph "CLI Frontend"
        CLI["discover.sh"]:::script
    end

    %% Module Executors
    subgraph "Module Executors"
        subgraph "Recon Modules"
            domain["domain.sh"]:::script
            person["person.sh"]:::script
            generate["generateTargets.sh"]:::script
            passive["passive.sh"]:::script
            direct["directObjectRef.sh"]:::script
            cve["cve.sh"]:::script
        end
        subgraph "Scanning Modules"
            api["api-scanner.sh"]:::script
            webapi["web-api-scanner.sh"]:::script
            ssl["ssl.sh"]:::script
            nikto["nikto.sh"]:::script
            waf["waf-detect.sh"]:::script
            nse["nse.sh"]:::script
            oauth["oauth-jwt-scanner.sh"]:::script
            sensitive["sensitive-scanner.sh"]:::script
            cloud["cloud-scanner.sh"]:::script
            container["container-scanner.sh"]:::script
            openredir["openredirect.sh"]:::script
        end
        subgraph "Payload & Listener Modules"
            payload["payload.sh"]:::script
            msfaux["msf-aux.sh"]:::script
            listener["listener.sh"]:::script
        end
    end

    %% Parsers
    subgraph "Parsers"
        parsers_dir["parsers/"]:::parser
        pburp["parse-burp.py"]:::parser
        pnessusfeed["parse-nessus-feed.py"]:::parser
        pnessus["parse-nessus.py"]:::parser
        pnexpose["parse-nexpose.py"]:::parser
        pnipper["parse-nipper.py"]:::parser
        pnmap["parse-nmap.py"]:::parser
        pqualys["parse-qualys.py"]:::parser
        utfdict["utfdictcsv.py"]:::parser
    end

    %% Resource Store & Configuration
    resource["resource/"]:::script
    config_dir["config/"]:::script

    %% External Tools & Services
    subgraph "External Tools & Services"
        nmap["Nmap"]:::tool
        metasploit["Metasploit"]:::tool
        burp["Burp"]:::tool
        trivy["Trivy"]:::tool
        dnsrecon["DNSRecon"]:::tool
        dnstwist["dnstwist"]:::tool
        subfinder["subfinder"]:::tool
        shodan["Shodan"]:::tool
        cloudapi["Cloud APIs"]:::tool
        k8sapi["Kubernetes API"]:::tool
    end

    %% Report Generation
    reportgen["report.sh"]:::script
    report_site["Static Report Site"]:::data

    %% Connections
    CLI -->|invokes| domain
    CLI -->|invokes| person
    CLI -->|invokes| generate
    CLI -->|invokes| passive
    CLI -->|invokes| direct
    CLI -->|invokes| cve
    CLI -->|invokes| api
    CLI -->|invokes| webapi
    CLI -->|invokes| ssl
    CLI -->|invokes| nikto
    CLI -->|invokes| waf
    CLI -->|invokes| nse
    CLI -->|invokes| oauth
    CLI -->|invokes| sensitive
    CLI -->|invokes| cloud
    CLI -->|invokes| container
    CLI -->|invokes| openredir
    CLI -->|invokes| payload
    CLI -->|invokes| msfaux
    CLI -->|invokes| listener
    CLI -->|loads config| config_dir

    %% Recon modules to external tools
    domain -->|queries| dnsrecon
    domain -->|enumerates| subfinder
    domain -->|checks| dnstwist
    person -->|queries| shodan

    %% Scanning modules to tools
    api -->|scans| nmap
    webapi -->|scans| burp
    ssl -->|scans| nmap
    nikto -->|scans| burp
    waf -->|detects| burp
    nse -->|runs scripts on| nmap
    oauth -->|tests| burp
    sensitive -->|scans| burp

    %% Dev modules
    cloud -->|uses| trivy
    cloud -->|uses| cloudapi
    container -->|uses| trivy
    container -->|uses| k8sapi

    %% Payload modules to Metasploit via resource
    payload -->|executes via| metasploit
    msfaux -->|executes via| metasploit
    metasploit -->|loads RC files| resource

    %% Tool outputs to Parsers
    nmap -->|output| pnmap
    burp -->|output| pburp
    nmap -->|output| pnipper
    pnmap -->|transform| parsers_dir
    pburp -->|transform| parsers_dir
    pnessusfeed -->|transform| parsers_dir
    pnessus -->|transform| parsers_dir
    pnexpose -->|transform| parsers_dir
    pqualys -->|transform| parsers_dir
    utfdict -->|transform| parsers_dir

    %% Parsers to report generator
    parsers_dir -->|CSV/HTML fragments| reportgen

    %% Report generation to site
    reportgen -->|builds| report_site

    %% Click Events
    click CLI "https://github.com/leebaird/discover/blob/main/discover.sh"
    click domain "https://github.com/leebaird/discover/blob/main/domain.sh"
    click person "https://github.com/leebaird/discover/blob/main/person.sh"
    click generate "https://github.com/leebaird/discover/blob/main/generateTargets.sh"
    click passive "https://github.com/leebaird/discover/blob/main/passive.sh"
    click direct "https://github.com/leebaird/discover/blob/main/directObjectRef.sh"
    click cve "https://github.com/leebaird/discover/blob/main/cve.sh"
    click api "https://github.com/leebaird/discover/blob/main/api-scanner.sh"
    click webapi "https://github.com/leebaird/discover/blob/main/web-api-scanner.sh"
    click ssl "https://github.com/leebaird/discover/blob/main/ssl.sh"
    click nikto "https://github.com/leebaird/discover/blob/main/nikto.sh"
    click waf "https://github.com/leebaird/discover/blob/main/waf-detect.sh"
    click nse "https://github.com/leebaird/discover/blob/main/nse.sh"
    click oauth "https://github.com/leebaird/discover/blob/main/oauth-jwt-scanner.sh"
    click sensitive "https://github.com/leebaird/discover/blob/main/sensitive-scanner.sh"
    click cloud "https://github.com/leebaird/discover/blob/main/cloud-scanner.sh"
    click container "https://github.com/leebaird/discover/blob/main/container-scanner.sh"
    click openredir "https://github.com/leebaird/discover/blob/main/openredirect.sh"
    click payload "https://github.com/leebaird/discover/blob/main/payload.sh"
    click msfaux "https://github.com/leebaird/discover/blob/main/msf-aux.sh"
    click listener "https://github.com/leebaird/discover/blob/main/listener.sh"
    click parsers_dir "https://github.com/leebaird/discover/tree/main/parsers/"
    click pburp "https://github.com/leebaird/discover/blob/main/parsers/parse-burp.py"
    click pnessusfeed "https://github.com/leebaird/discover/blob/main/parsers/parse-nessus-feed.py"
    click pnessus "https://github.com/leebaird/discover/blob/main/parsers/parse-nessus.py"
    click pnexpose "https://github.com/leebaird/discover/blob/main/parsers/parse-nexpose.py"
    click pnipper "https://github.com/leebaird/discover/blob/main/parsers/parse-nipper.py"
    click pnmap "https://github.com/leebaird/discover/blob/main/parsers/parse-nmap.py"
    click pqualys "https://github.com/leebaird/discover/blob/main/parsers/parse-qualys.py"
    click utfdict "https://github.com/leebaird/discover/blob/main/parsers/utfdictcsv.py"
    click resource "https://github.com/leebaird/discover/tree/main/resource/"
    click config_dir "https://github.com/leebaird/discover/tree/main/config/"
    click reportgen "https://github.com/leebaird/discover/blob/main/report.sh"

    %% Styles
    classDef script fill:#D0E6FF,stroke:#0366d6,color:#0366d6;
    classDef tool fill:#DFFFE0,stroke:#2c662d,color:#2c662d;
    classDef parser fill:#FFF4B8,stroke:#d6a700,color:#d6a700;
    classDef data fill:#FFD8B8,stroke:#d65a00,color:#d65a00;
```
