# c3rb3ru5d3d53c/mwcfg-modules architecture

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

- Interactive diagram: https://gitdiagram.com/c3rb3ru5d3d53c/mwcfg-modules
- Repository: https://github.com/c3rb3ru5d3d53c/mwcfg-modules

## Overview

##### Main Components
- CLI Utility Interface (mwcfg): Although not part of this repository, it is the consumer of these modules.
- Extraction Modules: Represented by directories like asyncrat, azorult, citadel, etc. Each module is self-contained with its own Python logic and YARA configuration.
- Common Infrastructure/Library: The project’s __init__.py files indicate an overall package structure that might share common helper functions, shared interfaces, or integration with the Malduck engine.
- YARA Rule Files: Each module contains a .yar file that provides the specific extraction rules for each malware type.
- (Implicit) Malduck Engine: Given the project’s purpose, there is an external dependency on Malduck which is used to perform the actual extraction operations.

##### Relationships and Interactions
- The CLI Utility (mwcfg) is the entry point that calls the appropriate extraction module based on user input or detected malware type.
- Each Extraction Module interacts with the Malduck engine (or its API) to process and extract configurations from malware samples.
- The .yar files serve as configuration/data driving the extraction logic in each module.
- Common code in the root (or shared across modules via __init__.py files) may provide uniform interfaces or helper functions used by each module.

##### Architectural Patterns and Design Principles
- Modular Design: Each malware extractor is self-contained, following a plug-in or module architecture. This allows for easy addition of new modules for more malware families.
- Separation of Concerns: There is a clear separation between the module code (extraction logic) and the data/rules (YARA configuration files).
- Extensibility: The structure encourages contributions, as adding a new module only requires following the existing pattern of including a Python file and a .yar file.
- Integration with an External CLI Utility: The separation between the CLI (mwcfg) and the extraction modules indicates a service layer that orchestrates which module to call based on context.

##### Relevant Technologies and Frameworks
- Python is the primary language.
- YARA rules (.yar files) are used for pattern/configuration extraction.
- The project likely integrates with the Malduck tool (external dependency) that processes malware configurations.
- Python packaging conventions (__init__.py files) indicate use of modules and possibly pip-installable packages.

##### Specific Elements
- Optional Grouping: You might group similar modules under a “Malware Extraction Modules” container, emphasizing the consistent architecture.

##### Detailed Breakdown
- For each extraction module:

## Diagram (Mermaid)

```mermaid
graph TD
    CLI["CLI Utility (mwcfg)"]:::cli
    ModuleManager["Module Manager"]:::manager
    CLI -->|"routes"| ModuleManager

    subgraph "Malware Extraction Modules"
        ASyncRATModule["ASyncRAT Module"]:::module
        ASyncRATConfig["ASyncRAT .yar"]:::config
        ASyncRATModule -->|"uses"| ASyncRATConfig

        AzorultModule["Azorult Module"]:::module
        AzorultConfig["Azorult .yar"]:::config
        AzorultModule -->|"uses"| AzorultConfig

        CitadelModule["Citadel Module"]:::module
        CitadelConfig["Citadel .yar"]:::config
        CitadelModule -->|"uses"| CitadelConfig

        HancitorModule["Hancitor Module"]:::module
        HancitorConfig["Hancitor .yar"]:::config
        HancitorModule -->|"uses"| HancitorConfig

        CaliberModule["44Caliber Stealer Module"]:::module
        CaliberConfig["44Caliber .yar"]:::config
        CaliberModule -->|"uses"| CaliberConfig

        ZLoaderModule["ZLoader Module"]:::module
        ZLoaderConfig["ZLoader .yar"]:::config
        ZLoaderModule -->|"uses"| ZLoaderConfig

        IcedIDModule["IcedID Module"]:::module
        IcedIDConfig["IcedID .yar"]:::config
        IcedIDModule -->|"uses"| IcedIDConfig

        EmotetModule["Emotet Module"]:::module
        EmotetConfig["Emotet .yar"]:::config
        EmotetModule -->|"uses"| EmotetConfig

        IcedIDAlt["IcedID Alt Extraction (photoloader)"]:::module
        IcedIDModule ---|"alt_method"| IcedIDAlt
    end

    ModuleManager -->|"selects"| ASyncRATModule
    ModuleManager -->|"selects"| AzorultModule
    ModuleManager -->|"selects"| CitadelModule
    ModuleManager -->|"selects"| HancitorModule
    ModuleManager -->|"selects"| CaliberModule
    ModuleManager -->|"selects"| ZLoaderModule
    ModuleManager -->|"selects"| IcedIDModule
    ModuleManager -->|"selects"| EmotetModule

    CommonLibrary["Common Infrastructure/Library"]:::common
    ASyncRATModule -- "shares" --> CommonLibrary
    AzorultModule -- "shares" --> CommonLibrary
    CitadelModule -- "shares" --> CommonLibrary
    HancitorModule -- "shares" --> CommonLibrary
    CaliberModule -- "shares" --> CommonLibrary
    ZLoaderModule -- "shares" --> CommonLibrary
    IcedIDModule -- "shares" --> CommonLibrary
    EmotetModule -- "shares" --> CommonLibrary

    MalduckEngine["Malduck Engine"]:::engine
    ASyncRATModule -->|"calls"| MalduckEngine
    AzorultModule -->|"calls"| MalduckEngine
    CitadelModule -->|"calls"| MalduckEngine
    HancitorModule -->|"calls"| MalduckEngine
    CaliberModule -->|"calls"| MalduckEngine
    ZLoaderModule -->|"calls"| MalduckEngine
    IcedIDModule -->|"calls"| MalduckEngine
    EmotetModule -->|"calls"| MalduckEngine
    IcedIDAlt -->|"calls"| MalduckEngine

    click ASyncRATModule "https://github.com/c3rb3ru5d3d53c/mwcfg-modules/blob/master/asyncrat/asyncrat.py"
    click ASyncRATConfig "https://github.com/c3rb3ru5d3d53c/mwcfg-modules/blob/master/asyncrat/asyncrat.yar"
    click AzorultModule "https://github.com/c3rb3ru5d3d53c/mwcfg-modules/blob/master/azorult/azorult.py"
    click AzorultConfig "https://github.com/c3rb3ru5d3d53c/mwcfg-modules/blob/master/azorult/azorult.yar"
    click CitadelModule "https://github.com/c3rb3ru5d3d53c/mwcfg-modules/blob/master/citadel/citadel.py"
    click CitadelConfig "https://github.com/c3rb3ru5d3d53c/mwcfg-modules/blob/master/citadel/citadel.yar"
    click HancitorModule "https://github.com/c3rb3ru5d3d53c/mwcfg-modules/blob/master/hancitor/hancitor.py"
    click HancitorConfig "https://github.com/c3rb3ru5d3d53c/mwcfg-modules/blob/master/hancitor/hancitor.yar"
    click CaliberModule "https://github.com/c3rb3ru5d3d53c/mwcfg-modules/blob/master/caliber/caliber.py"
    click CaliberConfig "https://github.com/c3rb3ru5d3d53c/mwcfg-modules/blob/master/caliber/caliber.yar"
    click ZLoaderModule "https://github.com/c3rb3ru5d3d53c/mwcfg-modules/blob/master/zloader/zloader.py"
    click ZLoaderConfig "https://github.com/c3rb3ru5d3d53c/mwcfg-modules/blob/master/zloader/zloader.yar"
    click IcedIDModule "https://github.com/c3rb3ru5d3d53c/mwcfg-modules/blob/master/icedid/peloader/icedid_peloader.py"
    click IcedIDConfig "https://github.com/c3rb3ru5d3d53c/mwcfg-modules/blob/master/icedid/peloader/icedid_peloader.yar"
    click EmotetModule "https://github.com/c3rb3ru5d3d53c/mwcfg-modules/blob/master/emotet/emotet.py"
    click EmotetConfig "https://github.com/c3rb3ru5d3d53c/mwcfg-modules/blob/master/emotet/emotet.yar"
    click CommonLibrary "https://github.com/c3rb3ru5d3d53c/mwcfg-modules/blob/master/__init__.py"

    classDef cli fill:#ADD8E6,stroke:#000,stroke-width:1px;
    classDef manager fill:#FFD700,stroke:#000,stroke-width:1px;
    classDef module fill:#FFA500,stroke:#000,stroke-width:1px;
    classDef config fill:#90EE90,stroke:#000,stroke-width:1px,stroke-dasharray:5,5;
    classDef engine fill:#D3D3D3,stroke:#000,stroke-width:1px;
    classDef common fill:#DA70D6,stroke:#000,stroke-width:1px;
```
