# decalage2/oletools architecture

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

- Interactive diagram: https://gitdiagram.com/decalage2/oletools
- Repository: https://github.com/decalage2/oletools

## Overview

##### Main Components

a) Core Analysis Modules:
- Main analysis tools (olevba, mraptor, msodde, oleobj, rtfobj, etc.)
- Their relationships and dependencies
- Common utilities they share

b) File Format Handlers:
- OLE2 file parser
- RTF parser
- OpenXML parser
- SWF analyzer

c) Support Components:
- Common utilities (in oletools/common/)
- Logging system (log_helper)
- Third-party integrations (thirdparty folder)

- Client Tools Layer                                     |
- [olevba] [mraptor] [msodde] [oleobj] [rtfobj] [oleid] [olebrowse] [olemeta] [others]  |

- Analysis Layer                                         |

- VBA Analysis   |  | XLM Analysis  |  | DDE Detection |  | Object Extraction    |      |

- Parser Layer                                           |

- OLE2 Parser  |  | RTF Parser  |  | OOXML      |  | SWF       |  | Format        |    |
- Handler     |  | Analyzer  |  | Detection     |    |

- Common Services Layer                                  |

- Logging System |  | Crypto Utils  |  | CLSID Library |  | Common IO Utilities  |      |

##### Connection Types

- Double lines: API boundaries

##### Additional Elements

- Version information
- Optional vs. required components
- Error handling paths

##### Metadata

A metadata section showing:
- Python version compatibility
- Key dependencies
- Licensing information
- Integration capabilities

##### Implementation Notes

- Maintain separate views for different detail levels
- A simplified view for quick understanding

- The modular nature of the tools
- The separation between analysis and parsing
- The common utilities shared across components
- The security-focused architecture
- The extensibility points for third-party integration

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Styles and classes
    classDef client fill:#3498db,stroke:#2980b9,color:white
    classDef analysis fill:#2ecc71,stroke:#27ae60,color:white
    classDef parser fill:#f1c40f,stroke:#f39c12,color:black
    classDef common fill:#95a5a6,stroke:#7f8c8d,color:white
    classDef security fill:#e74c3c,stroke:#c0392b,color:white
    classDef thirdparty fill:#9b59b6,stroke:#8e44ad,color:white

    %% Client Tools Layer
    subgraph ClientTools
        OleVBA["OleVBA"]:::client
        MRaptor["MacroRaptor"]:::client
        MsoDDE["MsoDDE"]:::client
        OleObj["OleObj"]:::client
        RTFObj["RTFObj"]:::client
        OleID["OleID"]:::client
        OleBrowse["OleBrowse"]:::client
        OleMeta["OleMeta"]:::client
    end

    %% Analysis Layer
    subgraph Analysis
        VBAAnalysis["VBA Analysis"]:::analysis
        XLMAnalysis["XLM Analysis"]:::analysis
        DDEDetection["DDE Detection"]:::analysis
        ObjExtraction["Object Extraction"]:::analysis
    end

    %% Parser Layer
    subgraph Parsers
        OLE2Parser["OLE2 Parser"]:::parser
        RTFParser["RTF Parser"]:::parser
        OOXMLHandler["OOXML Handler"]:::parser
        SWFAnalyzer["SWF Analyzer"]:::parser
        FormatDetection["Format Detection"]:::parser
        PPTParser["PowerPoint Parser"]:::parser
        XLSParser["Excel Parser"]:::parser
    end

    %% Common Services Layer
    subgraph CommonServices
        LogSystem["Logging System"]:::common
        CryptoUtils["Crypto Utils"]:::common
        CLSIDLib["CLSID Library"]:::common
        IOUtils["IO Utilities"]:::common
        ErrorHandler["Error Handler"]:::common
    end

    %% Third-party Integration Layer
    subgraph ThirdParty
        OLEDump["OLE Dump"]:::thirdparty
        TableFormat["Table Formatting"]:::thirdparty
        SWFTools["SWF Tools"]:::thirdparty
        FileGlob["File Globbing"]:::thirdparty
    end

    %% Connections
    ClientTools --> Analysis
    Analysis --> Parsers
    Parsers --> CommonServices
    Analysis --> CommonServices
    Parsers --> ThirdParty
    CommonServices --> ThirdParty

    %% Click events for component mapping
    click OleVBA "https://github.com/decalage2/oletools/blob/master/oletools/olevba.py"
    click MRaptor "https://github.com/decalage2/oletools/blob/master/oletools/mraptor.py"
    click MsoDDE "https://github.com/decalage2/oletools/blob/master/oletools/msodde.py"
    click OleObj "https://github.com/decalage2/oletools/blob/master/oletools/oleobj.py"
    click RTFObj "https://github.com/decalage2/oletools/blob/master/oletools/rtfobj.py"
    click OleID "https://github.com/decalage2/oletools/blob/master/oletools/oleid.py"
    click OleBrowse "https://github.com/decalage2/oletools/blob/master/oletools/olebrowse.py"
    click OleMeta "https://github.com/decalage2/oletools/blob/master/oletools/olemeta.py"
    click OOXMLHandler "https://github.com/decalage2/oletools/blob/master/oletools/ooxml.py"
    click PPTParser "https://github.com/decalage2/oletools/blob/master/oletools/ppt_parser.py"
    click XLSParser "https://github.com/decalage2/oletools/blob/master/oletools/xls_parser.py"
    click SWFAnalyzer "https://github.com/decalage2/oletools/blob/master/oletools/pyxswf.py"
    click LogSystem "https://github.com/decalage2/oletools/tree/master/oletools/common/log_helper/"
    click CLSIDLib "https://github.com/decalage2/oletools/blob/master/oletools/common/clsid.py"
    click CryptoUtils "https://github.com/decalage2/oletools/blob/master/oletools/crypto.py"
    click IOUtils "https://github.com/decalage2/oletools/blob/master/oletools/common/io_encoding.py"
    click OLEDump "https://github.com/decalage2/oletools/tree/master/oletools/thirdparty/oledump/"
    click TableFormat "https://github.com/decalage2/oletools/tree/master/oletools/thirdparty/prettytable/"
    click SWFTools "https://github.com/decalage2/oletools/tree/master/oletools/thirdparty/xxxswf/"
    click FileGlob "https://github.com/decalage2/oletools/tree/master/oletools/thirdparty/xglob/"
    click ErrorHandler "https://github.com/decalage2/oletools/blob/master/oletools/common/errors.py"
```
