# iss4cf0ng/duplexspycs architecture

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

- Interactive diagram: https://gitdiagram.com/iss4cf0ng/duplexspycs
- Repository: https://github.com/iss4cf0ng/duplexspycs

## Overview

##### Main Components
- Core Application/Controller: The heart of the tool seems to be controlled by the Program.cs and DuplexSpyCS.cs files. This is where the application is initialized and major application flows are coordinated.
- UI Layer: There are many Windows Forms (such as frmChat, frmDesktop, frmWebcam, frmKeyLogger, etc.) that act as the front-end interface for various functionalities. Organize these into logical groupings (for example, “Chat & Communication”, “File & Desktop Management”, “Registry/Process Management”, etc.).
- Business Logic Services: Several classes that are not UI forms handle logic such as file management (FilePacketWriter.cs, ImageWriter.cs), encryption (Crypto.cs), registry modifications (various frmReg* files), and system information gathering (frmSystem, frmWMI). Treat these as service components.
- Network/Communication Modules: The Listener.cs, and possibly classes like DSP.cs hint at a module that manages network communications or listening for remote commands. This component may also incorporate security/encryption (Crypto.cs) during data transmission.
- Supporting/Utility Modules: Files such as CodeDom.cs, CountdownTimer.cs, IniManager.cs, and VirtualKey.cs provide auxiliary support that facilitates scripting, timers, configuration management, and key event management.

##### Relationships and Interactions
- The main controller (Program.cs) launches the application and instantiates different UI forms as needed.
- UI forms interact with Business Logic Services (for example, the file management forms might call methods in FilePacketWriter.cs or ImageWriter.cs).
- The Network/Communication module (Listener.cs, DSP.cs) is responsible for establishing and managing remote connections, and it interacts with both the UI (to display connection or messaging status) and the Business Logic (to dispatch commands or data).
- Utility and helper classes (Crypto.cs, VirtualKey.cs, etc.) are consumed by multiple layers to support functionalities, such as encrypting/decrypting messages or simulating keyboard inputs.
- A clear data flow exists from user commands on the UI, to business logic actions, and then to external or system-level operations (like file transfers, registry modifications, or system monitoring).

##### Architectural Patterns and Design Principles
- Although the project is implemented as a monolithic application, components are logically separated by their function. This suggests an informal separation of concerns between the UI layer, the core logic (services/utilities), and the communication modules.
- The use of numerous Windows Forms suggests an event-driven paradigm where user actions trigger specific back-end operations.
- Helper libraries and classes indicate that many operations (such as encryption or configuration management) are abstracted into reusable modules, which can be represented in the system design by grouping these utility functions separately.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Core Layer
    subgraph "Core Layer"
        CoreController["Core Controller"]:::core
    end

    %% UI Layer
    subgraph "UI Layer"
        ChatUI["Chat & Communication (frmChat)"]:::ui
        DesktopUI["Desktop Management (frmDesktop)"]:::ui
        KeyLoggerUI["KeyLogger (frmKeyLogger)"]:::ui
        WebcamUI["Webcam Control (frmWebcam)"]:::ui
        OtherUI["Other UI Forms"]:::ui
    end

    %% Services Layer
    subgraph "Services Layer"
        subgraph "Business Logic Services"
            FilePacket["FilePacketWriter"]:::logic
            ImageWrite["ImageWriter"]:::logic
        end
        subgraph "Network Modules"
            ListenerMod["Listener"]:::comm
            DSPMod["DSP"]:::comm
        end
    end

    %% Utility Modules
    subgraph "Utility Modules"
        CodeDom["CodeDom"]:::utils
        Countdown["CountdownTimer"]:::utils
        CryptoUtil["Crypto"]:::utils
        IniManagerUtil["IniManager"]:::utils
        VirtualKeyUtil["VirtualKey"]:::utils
    end

    %% Connections from Core Layer to UI Layer
    CoreController -->|"launches"| ChatUI
    CoreController -->|"launches"| DesktopUI
    CoreController -->|"launches"| KeyLoggerUI
    CoreController -->|"launches"| WebcamUI
    CoreController -->|"launches"| OtherUI

    %% UI interactions with Business Logic Services
    ChatUI -->|"triggers"| FilePacket
    DesktopUI -->|"triggers"| FilePacket
    KeyLoggerUI -->|"triggers"| FilePacket
    WebcamUI -->|"triggers"| FilePacket
    OtherUI -->|"triggers"| ImageWrite

    %% Business Logic Services communicating with Network Modules
    FilePacket -->|"sends data"| ListenerMod
    FilePacket -->|"sends data"| DSPMod
    ImageWrite -->|"sends data"| ListenerMod
    ImageWrite -->|"sends data"| DSPMod

    %% Utility Modules support Business Logic and Communication Modules
    CodeDom ---|"supports"| FilePacket
    CodeDom ---|"supports"| ImageWrite
    Countdown ---|"supports"| FilePacket
    Countdown ---|"supports"| ImageWrite
    CryptoUtil ---|"supports"| ListenerMod
    CryptoUtil ---|"supports"| DSPMod
    IniManagerUtil ---|"supports"| FilePacket
    IniManagerUtil ---|"supports"| ImageWrite
    VirtualKeyUtil ---|"supports"| ListenerMod
    VirtualKeyUtil ---|"supports"| DSPMod

    %% Click Events
    click CoreController "https://github.com/iss4cf0ng/duplexspycs/blob/main/DuplexSpyCS/Program.cs"
    click ChatUI "https://github.com/iss4cf0ng/duplexspycs/blob/main/DuplexSpyCS/frmChat.cs"
    click DesktopUI "https://github.com/iss4cf0ng/duplexspycs/blob/main/DuplexSpyCS/frmDesktop.cs"
    click KeyLoggerUI "https://github.com/iss4cf0ng/duplexspycs/blob/main/DuplexSpyCS/frmKeyLogger.cs"
    click WebcamUI "https://github.com/iss4cf0ng/duplexspycs/blob/main/DuplexSpyCS/frmWebcam.cs"
    click FilePacket "https://github.com/iss4cf0ng/duplexspycs/blob/main/DuplexSpyCS/FilePacketWriter.cs"
    click ImageWrite "https://github.com/iss4cf0ng/duplexspycs/blob/main/DuplexSpyCS/ImageWriter.cs"
    click ListenerMod "https://github.com/iss4cf0ng/duplexspycs/blob/main/DuplexSpyCS/Listener.cs"
    click DSPMod "https://github.com/iss4cf0ng/duplexspycs/blob/main/DuplexSpyCS/DSP.cs"
    click CodeDom "https://github.com/iss4cf0ng/duplexspycs/blob/main/DuplexSpyCS/CodeDom.cs"
    click Countdown "https://github.com/iss4cf0ng/duplexspycs/blob/main/DuplexSpyCS/CountdownTimer.cs"
    click CryptoUtil "https://github.com/iss4cf0ng/duplexspycs/blob/main/DuplexSpyCS/Crypto.cs"
    click IniManagerUtil "https://github.com/iss4cf0ng/duplexspycs/blob/main/DuplexSpyCS/IniManager.cs"
    click VirtualKeyUtil "https://github.com/iss4cf0ng/duplexspycs/blob/main/DuplexSpyCS/VirtualKey.cs"

    %% Styles
    classDef core fill:#ADD8E6,stroke:#000,stroke-width:1px;
    classDef ui fill:#90EE90,stroke:#000,stroke-width:1px;
    classDef logic fill:#FFD700,stroke:#000,stroke-width:1px;
    classDef comm fill:#DA70D6,stroke:#000,stroke-width:1px;
    classDef utils fill:#FFB6C1,stroke:#000,stroke-width:1px;
```
