# defparam/smuggler architecture

> Architecture diagram of the GitHub repository defparam/smuggler, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2024-12-27). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/defparam/smuggler
- Repository: https://github.com/defparam/smuggler

## Overview

##### Project Type Analysis
This is a security testing tool specifically designed for HTTP Request Smuggling/Desync vulnerability detection. It's a command-line Python tool that performs automated testing of HTTP servers.

##### Main Components

A. Core Components:
- Input Handler (handles URL/stdin inputs)
- Configuration Manager (manages payload configurations)
- Request Generator (creates HTTP requests with mutations)
- Testing Engine (performs the actual testing)
- Response Analyzer (analyzes server responses)
- Payload Manager (handles payload storage)
- Logging System (manages output and logging)

B. Supporting Components:
- EasySSL Module (handles SSL/TLS connections)
- Configuration Files System
- Payload Storage System

**[Input Sources] → [Core Engine] → [Output Handlers]**
- ↑               ↕                ↓
**[Config Files] → [Test Modules] → [Payload Storage]**

##### Important Relationships to Highlight

- Bidirectional flow between the Core Engine and Test Modules
- Configuration file input flows
- Demonstrate payload generation and storage paths
- Separation between network handling and test logic

##### Technical Details

- Supported protocols (HTTP/HTTPS)
- Configuration file integration points
- Payload generation flow
- Testing methodology flow (CLTE/TECL detection)
- Output formats (console, log file, payload files)

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Input
        URL[URL Input]
        STDIN[STDIN Input]
        VHost[Virtual Host Handler]
    end

    subgraph Core
        Config[Configuration Manager]:::config
        TestEngine[Testing Engine]:::core
        ReqGen[Request Generator]:::core
        RespAnalyzer[Response Analyzer]:::core
        SSLHandler[SSL/TLS Handler]:::security
    end

    subgraph Storage
        PayloadStore[Payload Storage]:::storage
        ConfigFiles[Configuration Files]:::config
        LogFiles[Log Files]:::output
    end

    subgraph Output
        ColorOutput[Colored Console Output]:::output
        LogHandler[Log Handler]:::output
    end

    %% Input Flow
    URL --> TestEngine
    STDIN --> TestEngine
    VHost --> TestEngine

    %% Core Component Interactions
    Config --> TestEngine
    TestEngine --> ReqGen
    ReqGen --> SSLHandler
    SSLHandler --> RespAnalyzer
    RespAnalyzer --> TestEngine

    %% Storage Interactions
    ConfigFiles --> Config
    PayloadStore --> ReqGen
    TestEngine --> LogFiles

    %% Output Flow
    TestEngine --> ColorOutput
    TestEngine --> LogHandler

    %% Component Mappings with Click Events
    click Config "https://github.com/defparam/smuggler/tree/master//configs/"
    click ConfigFiles "https://github.com/defparam/smuggler/blob/master//configs/default.py"
    click ReqGen "https://github.com/defparam/smuggler/blob/master//lib/Payload.py"
    click SSLHandler "https://github.com/defparam/smuggler/blob/master//lib/EasySSL.py"
    click ColorOutput "https://github.com/defparam/smuggler/tree/master//lib/colorama/"
    click PayloadStore "https://github.com/defparam/smuggler/tree/master//payloads/"
    click TestEngine "https://github.com/defparam/smuggler/blob/master//smuggler.py"

    %% Styling
    classDef core fill:#3498db,stroke:#2980b9,color:white
    classDef config fill:#f1c40f,stroke:#f39c12,color:black
    classDef security fill:#e74c3c,stroke:#c0392b,color:white
    classDef output fill:#2ecc71,stroke:#27ae60,color:white
    classDef storage fill:#95a5a6,stroke:#7f8c8d,color:white

    %% Legend
    subgraph Legend
        L1[Core Components]:::core
        L2[Configuration]:::config
        L3[Security]:::security
        L4[Output]:::output
        L5[Storage]:::storage
    end
```
