# gotr00t0day/gsec architecture

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

- Interactive diagram: https://gitdiagram.com/gotr00t0day/gsec
- Repository: https://github.com/gotr00t0day/gsec

## Overview

##### Project type and purpose
- This is a Python‐based, command‐line Web Security Scanner & Exploitation framework (“Gsec”).
- It orchestrates passive reconnaissance, active/aggressive scanning, signature‐based checks, custom exploit scripts and Nuclei integration to find web vulnerabilities.

##### File structure
- Entry point
- gsec.py – main CLI driver that parses arguments and invokes scans
- install.py – sets up prerequisites (e.g., clones nuclei templates)
- Configuration & Secrets
- core/.shodan – holds the Shodan API key
- Recon & Scanning Modules
- modules/ – high‐level scan routines (fetch_requests, scan orchestrator, URL→IP, subdomain output)
- utils/ – low‐level scanners (portscanner, crawler, header checks, fuzzers, OS detect, payload lists, etc.)
- Parsers & Reporting
- parsers/ – adapters for nmap and nuclei output
- Signature DB & Plugins
- vuln_db/ – vulnerability definitions (XSS, SSRF, open redirect, etc.)
- plugins/ – small checks (robots.txt, security.txt, user‐agent tests, favicon, cookies, tokens, shellshock, sitemap)
- Exploits
- exploits/ – proof‐of‐concept scripts (e.g., F5 BIG-IP scanner, Shellshock exploit)
- Wordlists & Tools
- wordlists/ – default wordlists for subdomain brute‐forcing, payloads, etc.
- tools/jaeles – optional integration
- Output
- output/ – directory where long results are saved (e.g., waybackurls.txt)

##### README for additional insights
- Summarizes features in three phases: Passive Scan, Normal/Aggressive Scan, Ultimate (Nuclei)
- Lists external dependencies: Python 3.11, Go (for Nuclei), certifi for SSL fix
- Describes usage patterns and how output is persisted

##### Essential architectural elements
- Plugin loader in CLI to emphasize extensibility

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% CLI Entrypoint
    subgraph "CLI Entrypoint"
        CLI_gsec["gsec.py"]:::core
        CLI_install["install.py"]:::core
    end

    %% Configuration
    subgraph "Configuration Layer"
        ShodanKey[".shodan"]:::core
    end

    %% Passive Recon Engine
    subgraph "Passive Recon Engine" 
        FetchRequests["fetch_requests.py"]:::core
        PassiveUtils["passive_recon.py"]:::core
        Crawler["crawler.py"]:::core
        SubdomainScanner["subdomainscanner.py"]:::core
        DomainsScript["domains.sh"]:::core
        CertshScript["certsh.sh"]:::core
    end

    %% Active Scan Engine
    subgraph "Active Scan Engine"
        ScanModule["scan.py"]:::core
        PortScanner["portscanner.py"]:::core
        Headers["headers.py"]:::core
        OSDetect["osdetect.py"]:::core
        CMSScanner["cmsscanner.py"]:::core
        WebserverScanner["webserver_scanner.py"]:::core
        API_Scanner["api_scanner.py"]:::core
        API_Fuzzer["api_fuzzer.py"]:::core
        JS_Scanner["javascript_scanner.py"]:::core
        DirBrute["dirbrutescanner.py"]:::core
        ParamFinder["param_finder.py"]:::core
    end

    %% Nuclei Integration
    subgraph "Nuclei Integration"
        NucleiParser["nuclei.py"]:::core
        NucleiTemplates["nuclei-templates"]:::external
    end

    %% Signature/Plugin Engine
    subgraph "Signature/Plugin Engine"
        VulnerabilityDB["vuln_db/"]:::core
        Plugins["plugins/"]:::core
    end

    %% Exploitation Layer
    subgraph "Exploitation Layer"
        F5Scanner["f5bigip_scanner.py"]:::core
        Shellshock["shellshock.py"]:::core
    end

    %% Parsers & Reporter
    subgraph "Parsers & Reporter"
        NmapParser["nmap.py"]:::core
        NucleiOutParser["nuclei.py"]:::core
        SubOutput["sub_output.py"]:::core
    end

    %% Data Stores
    subgraph "Data Stores"
        Wordlists["wordlists/"]:::datastore
        OutputDir["output/"]:::datastore
    end

    %% External Services
    ShodanAPI["Shodan API"]:::external
    DNS["DNS Servers"]:::external
    Wayback["Waybackurls Service"]:::external
    Certsh["Cert.sh API"]:::external
    RapidDNS["RapidDNS"]:::external

    %% Connections
    CLI_gsec -->|loads key| ShodanKey
    CLI_gsec -->|invokes| FetchRequests
    ShodanKey --> FetchRequests

    FetchRequests --> PassiveUtils
    PassiveUtils --> ShodanAPI
    PassiveUtils --> DNS
    Crawler --> Wayback
    SubdomainScanner --> DNS
    SubdomainScanner --> RapidDNS
    DomainsScript --> DNS
    CertshScript --> Certsh

    FetchRequests -->|results| ScanModule
    CLI_gsec -->|invokes| ScanModule
    ScanModule --> PortScanner
    ScanModule --> Headers
    ScanModule --> OSDetect
    ScanModule --> CMSScanner
    ScanModule --> WebserverScanner
    ScanModule --> API_Scanner
    ScanModule --> API_Fuzzer
    ScanModule --> JS_Scanner
    ScanModule --> DirBrute
    ScanModule --> ParamFinder

    CLI_gsec -->|runs| NucleiParser
    NucleiParser --> NucleiTemplates

    CLI_gsec -->|runs| VulnerabilityDB
    CLI_gsec -->|runs| Plugins

    CLI_gsec -->|runs| F5Scanner
    CLI_gsec -->|runs| Shellshock

    ScanModule --> NmapParser
    NucleiParser --> NucleiOutParser
    VulnerabilityDB --> SubOutput
    Plugins --> SubOutput
    F5Scanner --> SubOutput
    Shellshock --> SubOutput

    SubOutput --> OutputDir

    %% Click Events
    click CLI_gsec "https://github.com/gotr00t0day/gsec/blob/main/gsec.py"
    click CLI_install "https://github.com/gotr00t0day/gsec/blob/main/install.py"
    click ShodanKey "https://github.com/gotr00t0day/gsec/blob/main/core/.shodan"
    click FetchRequests "https://github.com/gotr00t0day/gsec/blob/main/modules/fetch_requests.py"
    click PassiveUtils "https://github.com/gotr00t0day/gsec/blob/main/utils/passive_recon.py"
    click Crawler "https://github.com/gotr00t0day/gsec/blob/main/utils/crawler.py"
    click SubdomainScanner "https://github.com/gotr00t0day/gsec/blob/main/utils/subdomainscanner.py"
    click DomainsScript "https://github.com/gotr00t0day/gsec/blob/main/utils/scripts/domains.sh"
    click CertshScript "https://github.com/gotr00t0day/gsec/blob/main/utils/subdomainscanners/certsh.sh"
    click ScanModule "https://github.com/gotr00t0day/gsec/blob/main/modules/scan.py"
    click PortScanner "https://github.com/gotr00t0day/gsec/blob/main/utils/portscanner.py"
    click Headers "https://github.com/gotr00t0day/gsec/blob/main/utils/headers.py"
    click OSDetect "https://github.com/gotr00t0day/gsec/blob/main/utils/osdetect.py"
    click CMSScanner "https://github.com/gotr00t0day/gsec/blob/main/utils/cmsscanner.py"
    click WebserverScanner "https://github.com/gotr00t0day/gsec/blob/main/utils/webserver_scanner.py"
    click API_Scanner "https://github.com/gotr00t0day/gsec/blob/main/utils/api_scanner.py"
    click API_Fuzzer "https://github.com/gotr00t0day/gsec/blob/main/utils/api_fuzzer.py"
    click JS_Scanner "https://github.com/gotr00t0day/gsec/blob/main/utils/javascript_scanner.py"
    click DirBrute "https://github.com/gotr00t0day/gsec/blob/main/utils/dirbrutescanner.py"
    click ParamFinder "https://github.com/gotr00t0day/gsec/blob/main/utils/param_finder.py"
    click NucleiParser "https://github.com/gotr00t0day/gsec/blob/main/parsers/nuclei.py"
    click VulnerabilityDB "https://github.com/gotr00t0day/gsec/tree/main/vuln_db/"
    click Plugins "https://github.com/gotr00t0day/gsec/tree/main/plugins/"
    click F5Scanner "https://github.com/gotr00t0day/gsec/blob/main/exploits/f5bigip_scanner.py"
    click Shellshock "https://github.com/gotr00t0day/gsec/blob/main/exploits/shellshock.py"
    click NmapParser "https://github.com/gotr00t0day/gsec/blob/main/parsers/nmap.py"
    click NucleiOutParser "https://github.com/gotr00t0day/gsec/blob/main/parsers/nuclei.py"
    click SubOutput "https://github.com/gotr00t0day/gsec/blob/main/modules/sub_output.py"
    click Wordlists "https://github.com/gotr00t0day/gsec/tree/main/wordlists/"
    click OutputDir "https://github.com/gotr00t0day/gsec/tree/main/output/"

    %% Styles
    classDef core fill:#cce5ff,stroke:#333,stroke-width:1px
    classDef external fill:#d4edda,stroke:#333,stroke-width:1px
    classDef datastore fill:#ffe5cc,stroke:#333,stroke-width:1px
```
