# dharani-sanjaiy/malware-development architecture

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

- Interactive diagram: https://gitdiagram.com/dharani-sanjaiy/malware-development
- Repository: https://github.com/dharani-sanjaiy/malware-development

## Overview

##### Core Components
- Injection Modules: Each C++ file (e.g., APCInjector.cpp, DLLInjector.cpp, ClassicThreadHijacking.cpp, etc.) acts as a stand-alone module demonstrating a specific injection technique.
- NTAPI Support: The NTAPI folder (Headers.h and NtRemoteThreadInjection.cpp) provides support for low-level operations, likely used by one or more of the injection techniques.
- Payload: The shellcode (calc.exe) is the actual payload employed across these modules.
- Shared Infrastructure: Although not explicitly delineated as libraries or other services, the repository’s structure indicates that each injector relies on common techniques and possibly shared helper functions.

##### Highlighting Architectural Patterns and Design Principles
- Modularity: Each file represents a distinct module based on the injection technique. This encourages a modular architectural view.
- Separation of Concerns: The separation between payload generation (using msfvenom’s shellcode) and injection methods is a key design element.
- Reuse of Low-Level Components: The NTAPI directory encapsulates the low-level Windows API calls that can be reused across multiple injection techniques.

##### Relevant Technologies and Frameworks
- Windows API: A core part of these techniques relies on Windows-specific APIs and NT internals.
- C++: The source files indicate that the project is implemented in C++.
- Shellcode (calc.exe generated using msfvenom): Highlight this as the payload used across injection techniques.

##### Essential Elements
- Each injection technique (e.g., APCInjector, DLLInjector, etc.) should be represented as its own node.
- The “NTAPI” component (from the NTAPI folder) should be connected to those modules that depend on it.
- Notes or callouts if necessary to denote how each component interacts with system internals.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Injection Techniques Subgraph
    subgraph "Injection Techniques"
        %% APC Injection Group
        subgraph "APC Injection"
            APCA["APCInjector.cpp"]:::injector
            APCB["EarlyBirdQueueUserAPCInjection.cpp"]:::injector
        end

        %% Remote Thread Injection Group
        subgraph "Remote Thread Injection"
            RT1["AutoRemoteThreadInjection.cpp"]:::injector
            RT2["CreateRemoteThreadPInjection.cpp"]:::injector
            RT3["CreateRemoteThreadPInjection2.cpp"]:::injector
            RT4["RemoteFunctionStomping.cpp"]:::injector
        end

        %% DLL Injection Group
        subgraph "DLL Injection"
            DLL["DLLInjector.cpp"]:::injector
        end

        %% Classic Thread Hijacking Group
        subgraph "Classic Thread Hijacking"
            TH["ClassicThreadHijacking.cpp"]:::injector
        end

        %% Access Token Manipulation Group
        subgraph "Access Token Manipulation"
            AT1["AccessTokenManipulation.cpp"]:::injector
            AT2["AutoAccessTokenManipulation.cpp"]:::injector
        end

        %% PPID Spoofing Technique
        PT["PPIDSpoofing.cpp"]:::injector
    end

    %% NTAPI Support Subgraph
    subgraph "NTAPI Support"
        NT1["Headers.h"]:::ntapi
        NT2["NtRemoteThreadInjection.cpp"]:::ntapi
    end

    %% Payload Component
    Payload["Payload (calc.exe shellcode)"]:::payload

    %% Relationships: Injection modules inject payload
    APCA -->|"injects"| Payload
    RT1 -->|"injects"| Payload
    DLL  -->|"injects"| Payload
    TH   -->|"injects"| Payload
    AT1  -->|"injects"| Payload
    PT   -->|"injects"| Payload

    %% Relationships: Remote Thread Injection modules calling NTAPI functions
    RT1 -->|"calls"| NT1
    RT2 -->|"calls"| NT1
    RT3 -->|"calls"| NT1
    RT4 -->|"calls"| NT2

    %% Styles
    classDef injector fill:#add8e6,stroke:#00008b,stroke-width:2px;
    classDef ntapi fill:#ffa500,stroke:#8b4500,stroke-width:2px;
    classDef payload fill:#90ee90,stroke:#006400,stroke-width:2px;

    %% Click Events
    click APCA "https://github.com/dharani-sanjaiy/malware-development/blob/main/APCInjector.cpp"
    click APCB "https://github.com/dharani-sanjaiy/malware-development/blob/main/EarlyBirdQueueUserAPCInjection.cpp"
    click RT1 "https://github.com/dharani-sanjaiy/malware-development/blob/main/AutoRemoteThreadInjection.cpp"
    click RT2 "https://github.com/dharani-sanjaiy/malware-development/blob/main/CreateRemoteThreadPInjection.cpp"
    click RT3 "https://github.com/dharani-sanjaiy/malware-development/blob/main/CreateRemoteThreadPInjection2.cpp"
    click RT4 "https://github.com/dharani-sanjaiy/malware-development/blob/main/RemoteFunctionStomping.cpp"
    click DLL "https://github.com/dharani-sanjaiy/malware-development/blob/main/DLLInjector.cpp"
    click TH "https://github.com/dharani-sanjaiy/malware-development/blob/main/ClassicThreadHijacking.cpp"
    click AT1 "https://github.com/dharani-sanjaiy/malware-development/blob/main/AccessTokenManipulation.cpp"
    click AT2 "https://github.com/dharani-sanjaiy/malware-development/blob/main/AutoAccessTokenManipulation.cpp"
    click PT "https://github.com/dharani-sanjaiy/malware-development/blob/main/PPIDSpoofing.cpp"
    click NT1 "https://github.com/dharani-sanjaiy/malware-development/blob/main/NTAPI/Headers.h"
    click NT2 "https://github.com/dharani-sanjaiy/malware-development/blob/main/NTAPI/NtRemoteThreadInjection.cpp"
```
