# khast3x/h8mail architecture

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

- Interactive diagram: https://gitdiagram.com/khast3x/h8mail
- Repository: https://github.com/khast3x/h8mail

## Overview

##### Main Components Identification

The system should be represented with these key components:

a) Core Application Layer
- Main execution module (__main__.py)
- Configuration handling
- Input processing

b) Utility Services Layer
- Search modules
- Output formatters
- API integrators

c) External Services Integration Layer
- Multiple API services (HaveIBeenPwned, Hunter.io, Snusbase, etc.)
- Local breach data processors

**[Input Sources] → [Core Application] → [Processing Layers] → [Output Handlers]**
- ↑                   ↕                      ↕                    ↓
- [Configuration Manager]─────────┘            [Output Formats]

##### Component Details

a) Input Sources (Top Left):
- Email targets
- URL sources
- Local breach files
- Compressed archives
- Custom queries

b) Core Application (Center):
- Main orchestrator
- Configuration manager
- API key handler

c) Processing Layers (Right Center):
- API Services Integration
- Local Search Engine
- Pattern Matching
- Email Chase System

d) Output Handlers (Bottom Right):
- CSV formatter
- JSON formatter
- Console output
- Summary generator

##### Technical Details

- Python version compatibility
- External dependencies (requests)
- Docker support
- File handling capabilities
- API service status indicators

Remember to highlight the tool's key strengths:
- Multiprocessing capabilities
- Multiple API service integration
- Local breach processing
- Flexible input/output options
- Configuration management

This will create a comprehensive system design that accurately represents h8mail's architecture while being useful for both development and documentation purposes.

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Input
        IT[Input Targets]
        UL["URL Sources"]:::input
        LB["Local Breach Files"]:::input
        CA["Compressed Archives"]:::input
        CQ["Custom Queries"]:::input
    end

    subgraph Core
        ME["Main Execution"]:::core
        CR["Core Runner"]:::core
        BC["Base Classes"]:::core
        click ME "https://github.com/khast3x/h8mail/blob/master/h8mail/__main__.py"
        click CR "https://github.com/khast3x/h8mail/blob/master/h8mail/utils/run.py"
        click BC "https://github.com/khast3x/h8mail/blob/master/h8mail/utils/classes.py"
    end

    subgraph Config
        CG["Config Generator"]:::config
        VC["Version Control"]:::config
        click CG "https://github.com/khast3x/h8mail/blob/master/h8mail/utils/gen_config.py"
        click VC "https://github.com/khast3x/h8mail/blob/master/h8mail/utils/version.py"
    end

    subgraph "Processing Modules"
        BCP["Breach Compilation"]:::process
        LGS["Local GZip Search"]:::process
        LS["Local Search"]:::process
        IX["IntelX Integration"]:::process
        UP["URL Processing"]:::process
        click BCP "https://github.com/khast3x/h8mail/blob/master/h8mail/utils/breachcompilation.py"
        click LGS "https://github.com/khast3x/h8mail/blob/master/h8mail/utils/localgzipsearch.py"
        click LS "https://github.com/khast3x/h8mail/blob/master/h8mail/utils/localsearch.py"
        click IX "https://github.com/khast3x/h8mail/blob/master/h8mail/utils/intelx.py"
        click UP "https://github.com/khast3x/h8mail/blob/master/h8mail/utils/url.py"
    end

    subgraph "Output Handlers"
        JF["JSON Formatter"]:::output
        RP["Results Printer"]:::output
        SG["Summary Generator"]:::output
        click JF "https://github.com/khast3x/h8mail/blob/master/h8mail/utils/print_json.py"
        click RP "https://github.com/khast3x/h8mail/blob/master/h8mail/utils/print_results.py"
        click SG "https://github.com/khast3x/h8mail/blob/master/h8mail/utils/summary.py"
    end

    subgraph "Utility Services"
        HF["Helper Functions"]:::utility
        CF["Color Formatting"]:::utility
        EC["Email Chase"]:::utility
        IH["IntelX Helpers"]:::utility
        click HF "https://github.com/khast3x/h8mail/blob/master/h8mail/utils/helpers.py"
        click CF "https://github.com/khast3x/h8mail/blob/master/h8mail/utils/colors.py"
        click EC "https://github.com/khast3x/h8mail/blob/master/h8mail/utils/chase.py"
        click IH "https://github.com/khast3x/h8mail/blob/master/h8mail/utils/intelx_helpers.py"
    end

    subgraph "Testing"
        TS["Test Suite"]:::test
        TD["Test Data"]:::test
        click TS "https://github.com/khast3x/h8mail/blob/master/tests/test_h8mail.py"
        click TD "https://github.com/khast3x/h8mail/blob/master/tests/test_email.txt"
    end

    %% Connections
    IT --> ME
    UL --> ME
    LB --> ME
    CA --> ME
    CQ --> ME

    ME --> CR
    CR --> BC

    CG --> ME
    VC --> ME

    CR --> BCP
    CR --> LGS
    CR --> LS
    CR --> IX
    CR --> UP

    BCP --> RP
    LGS --> RP
    LS --> RP
    IX --> RP
    UP --> RP

    RP --> JF
    RP --> SG

    HF -.-> CR
    CF -.-> RP
    EC -.-> CR
    IH -.-> IX

    TS -.-> ME
    TD -.-> TS

    %% Styles
    classDef core fill:#2196F3,stroke:#1565C0,color:white
    classDef config fill:#757575,stroke:#424242,color:white
    classDef process fill:#FF9800,stroke:#F57C00,color:white
    classDef output fill:#9C27B0,stroke:#7B1FA2,color:white
    classDef utility fill:#4CAF50,stroke:#388E3C,color:white
    classDef test fill:#795548,stroke:#5D4037,color:white
    classDef input fill:#607D8B,stroke:#455A64,color:white
```
