# oj/gobuster architecture

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

- Interactive diagram: https://gitdiagram.com/oj/gobuster
- Repository: https://github.com/oj/gobuster

## Overview

##### Main Components Overview
The system should be divided into these primary components:

a. CLI Interface Layer
- Location: `/cli` directory
- Purpose: Handles user input and command processing
- Key components: Command handlers for different modes (dir, dns, s3, etc.)

b. Core Library Layer
- Location: `/libgobuster` directory
- Purpose: Contains core functionality shared across all modes
- Components: HTTP handling, logging, progress tracking, and common interfaces

c. Mode-Specific Modules
- Locations: Individual directories for each mode (gobusterdir, gobusterdns, etc.)
- Purpose: Implements specific enumeration logic for each supported mode

##### Component Relationships

**[CLI Layer] → [Core Library] ← [Mode Modules]**

##### Detailed Component Breakdown

a. CLI Layer (Top Level):
**[Root Command] → [Mode Commands]**
- ↓
- [dir] [dns] [s3] [gcs] [vhost] [fuzz] [tftp]

b. Core Library (Middle Layer):
**[libgobuster]**
- HTTP Client
- Helper Functions
- Progress Tracking
- Logging System
- Common Interfaces

c. Mode Modules (Bottom Layer):
**[Mode-Specific Implementation]**
- Options
- Results
- Core Logic

##### Data Flow Representation

**[User Input] → [CLI] → [Mode Handler] → [Core Library] → [External Service]**
- ↑
- [Mode-Specific Logic]

##### Implementation Details

Important features:
- Concurrent execution (threading)
- Error handling
- Configuration management
- Result formatting

##### Notes

Important notes:
- Threading model
- Error handling strategy
- Extension points
- Configuration options

##### The extensibility of the system for adding new modes

This design captures Gobuster's architecture as a modular, extensible security tool with multiple specialized enumeration modes sharing common core functionality.

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph CLI
        Root["Root Command"]:::cli
        ModeCmd["Mode Commands"]:::cli
        Dir["Directory Mode"]:::cli
        DNS["DNS Mode"]:::cli
        S3["S3 Mode"]:::cli
        GCS["GCS Mode"]:::cli
        VHost["VHost Mode"]:::cli
        Fuzz["Fuzz Mode"]:::cli
        TFTP["TFTP Mode"]:::cli

        Root --> ModeCmd
        ModeCmd --> Dir
        ModeCmd --> DNS
        ModeCmd --> S3
        ModeCmd --> GCS
        ModeCmd --> VHost
        ModeCmd --> Fuzz
        ModeCmd --> TFTP
    end

    subgraph CoreLib["Core Library"]
        HTTP["HTTP Client"]:::core
        Helpers["Helper Functions"]:::core
        Progress["Progress Tracking"]:::core
        Logger["Logging System"]:::core
        Interfaces["Common Interfaces"]:::core
        Options["Core Options"]:::core
        HTTPOpts["HTTP Options"]:::core
    end

    subgraph ModeModules["Mode-Specific Modules"]
        DirMode["Directory Mode Implementation"]:::mode
        DNSMode["DNS Mode Implementation"]:::mode
        S3Mode["S3 Mode Implementation"]:::mode
        GCSMode["GCS Mode Implementation"]:::mode
        VHostMode["VHost Mode Implementation"]:::mode
        FuzzMode["Fuzz Mode Implementation"]:::mode
        TFTPMode["TFTP Mode Implementation"]:::mode

        DirOpts["Directory Options"]:::mode
        DNSOpts["DNS Options"]:::mode
        S3Opts["S3 Options"]:::mode
        GCSOpts["GCS Options"]:::mode
        VHostOpts["VHost Options"]:::mode
        FuzzOpts["Fuzz Options"]:::mode
        TFTPOpts["TFTP Options"]:::mode
    end

    Dir --> DirMode
    DNS --> DNSMode
    S3 --> S3Mode
    GCS --> GCSMode
    VHost --> VHostMode
    Fuzz --> FuzzMode
    TFTP --> TFTPMode

    DirMode --> HTTP
    DNSMode --> Interfaces
    S3Mode --> HTTP
    GCSMode --> HTTP
    VHostMode --> HTTP
    FuzzMode --> HTTP
    TFTPMode --> Interfaces

    DirMode --> DirOpts
    DNSMode --> DNSOpts
    S3Mode --> S3Opts
    GCSMode --> GCSOpts
    VHostMode --> VHostOpts
    FuzzMode --> FuzzOpts
    TFTPMode --> TFTPOpts

    classDef cli fill:#3498db,stroke:#2980b9,color:white
    classDef core fill:#2ecc71,stroke:#27ae60,color:white
    classDef mode fill:#e67e22,stroke:#d35400,color:white
    classDef external fill:#95a5a6,stroke:#7f8c8d,color:white

    click Root "https://github.com/oj/gobuster/blob/master/cli/cmd/root.go"
    click Dir "https://github.com/oj/gobuster/blob/master/cli/cmd/dir.go"
    click DNS "https://github.com/oj/gobuster/blob/master/cli/cmd/dns.go"
    click S3 "https://github.com/oj/gobuster/blob/master/cli/cmd/s3.go"
    click GCS "https://github.com/oj/gobuster/blob/master/cli/cmd/gcs.go"
    click VHost "https://github.com/oj/gobuster/blob/master/cli/cmd/vhost.go"
    click Fuzz "https://github.com/oj/gobuster/blob/master/cli/cmd/fuzz.go"
    click TFTP "https://github.com/oj/gobuster/blob/master/cli/cmd/tftp.go"
    click HTTP "https://github.com/oj/gobuster/blob/master/libgobuster/http.go"
    click Helpers "https://github.com/oj/gobuster/blob/master/libgobuster/helpers.go"
    click Progress "https://github.com/oj/gobuster/blob/master/libgobuster/progress.go"
    click Logger "https://github.com/oj/gobuster/blob/master/libgobuster/logger.go"
    click Interfaces "https://github.com/oj/gobuster/blob/master/libgobuster/interfaces.go"
    click Options "https://github.com/oj/gobuster/blob/master/libgobuster/options.go"
    click HTTPOpts "https://github.com/oj/gobuster/blob/master/libgobuster/options_http.go"
    click DirMode "https://github.com/oj/gobuster/blob/master/gobusterdir/gobusterdir.go"
    click DNSMode "https://github.com/oj/gobuster/blob/master/gobusterdns/gobusterdns.go"
    click S3Mode "https://github.com/oj/gobuster/blob/master/gobusters3/gobusters3.go"
    click GCSMode "https://github.com/oj/gobuster/blob/master/gobustergcs/gobustersgcs.go"
    click VHostMode "https://github.com/oj/gobuster/blob/master/gobustervhost/gobustervhost.go"
    click FuzzMode "https://github.com/oj/gobuster/blob/master/gobusterfuzz/gobusterfuzz.go"
    click TFTPMode "https://github.com/oj/gobuster/blob/master/gobustertftp/gobustertftp.go"
    click DirOpts "https://github.com/oj/gobuster/blob/master/gobusterdir/options.go"
    click DNSOpts "https://github.com/oj/gobuster/blob/master/gobusterdns/options.go"
    click S3Opts "https://github.com/oj/gobuster/blob/master/gobusters3/options.go"
    click GCSOpts "https://github.com/oj/gobuster/blob/master/gobustergcs/options.go"
    click VHostOpts "https://github.com/oj/gobuster/blob/master/gobustervhost/options.go"
    click FuzzOpts "https://github.com/oj/gobuster/blob/master/gobusterfuzz/options.go"
    click TFTPOpts "https://github.com/oj/gobuster/blob/master/gobustertftp/options.go"
```
