# vedattascier/evil-winrm architecture

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

- Interactive diagram: https://gitdiagram.com/vedattascier/evil-winrm
- Repository: https://github.com/vedattascier/evil-winrm

## Overview

##### Project Type & Purpose
- Evil-WinRM is a Ruby-based command-line tool designed for penetration testing. Its core purpose is to provide an interactive shell for communicating with Windows systems via WinRM. It supports various in-memory payload loading techniques (e.g., PowerShell scripts, DLLs, C# assemblies, and x64 payloads using the donut method) and multiple authentication methods (password, passthrough hash, and Kerberos).

##### Main Components
- Command-Line Interface (CLI) Component:
- User’s interaction point where arguments/options (such as -i, -u, -p, -s, -e, etc.) are provided.
- Different installation/distribution approaches (Ruby gem, standalone script execution, bundler, Docker) as deployment contexts.
- Core Processing Engine:
- The main script (evil-winrm.rb) can be depicted as the central processing unit that interprets user input and coordinates the overall action of the tool.
- WinRM Handler: Manages connections to the remote Windows host using the WinRM protocol.
- Payload Loader Manager: Responsible for loading PowerShell scripts, DLLs, C# assemblies, and injecting x64 payloads.
- Advanced Command Processor: Manages commands like “upload,” “download,” “services,” and “menu,” and deals with features such as command history, auto-completion, and colorized output.
- Authentication & Security Module:
- Support for multiple authentication techniques, including standard username/password, pass-the-hash, Kerberos authentication (with ticketing and ccache integration), and certificate-based auth (public/private keys).
- External Dependencies & Libraries:
- Ruby gems such as winrm, winrm-fs, and stringio and note that these are fundamental to making the WinRM protocol calls and handling file streams.
- Also mention the integration with third-party tools for payload generation (donut, ticket_converter.py, etc.).
- Docker Container (Optional Deployment Unit):
- A Docker block/component to represent the prebuilt container image (oscarakaelvis/evil-winrm). Show that it encapsulates the CLI tool, mapped volumes for script/executable paths and data, and facilitates deployment in containerized environments.

##### Relationships & Data Flow
- From the CLI parser to the WinRM Handler that establishes the remote connection.
- From the WinRM Handler to the Payload Loader submodules that load scripts, DLLs, or payloads into memory.
- External flows where the tool performs file transfers (upload/download) with the remote Windows machine and how those actions might interact with the local file system (or Docker volumes in container scenarios).

##### Architectural Patterns & Design Principles
- The CLI (input), core engine (business logic/processing), authentication (security), and external integrations (WinRM API, third-party payload generators).
- Separation of concerns—even if the code resides in a single Ruby file—by labeling areas of responsibility (e.g., “Payload Loading Module,” “Authentication Module,” etc.).

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% User Interaction
    subgraph "User Interaction"
        UI("User CLI Input"):::frontend
    end

    %% Core Processing Engine (evil-winrm.rb)
    subgraph "Core Processing Engine (evil-winrm.rb)"
        CLI("CLI Parser"):::core
        WH("WinRM Connection Manager"):::core
        PL("In-memory Payload Loader"):::core
        CP("Advanced Command Processor"):::core
        AU("Authentication Module"):::core
    end

    %% External Dependencies
    subgraph "External Dependencies"
        GF1("Gemfile"):::dependency
        GF2("Gemfile.lock"):::dependency
    end

    %% Deployment Environment
    subgraph "Deployment Environment"
        DO("Docker Container Environment"):::deployment
    end

    %% Remote Windows Server
    RWS("Remote Windows Server (WinRM)"):::remote

    %% Data Flows
    UI --> CLI
    CLI --> WH
    WH --> PL
    PL --> CP
    UI --> AU

    %% External Dependencies support core operations
    GF1 -- "provides gems" --> CLI
    GF2 -- "supports connection" --> WH

    %% Docker container encapsulates the CLI tool
    DO --> CLI

    %% Communication with Remote Server
    WH -->|"establishes connection"| RWS
    CP -->|"handles upload/download"| RWS

    %% Styles
    classDef frontend fill:#C1E1FF,stroke:#333,stroke-width:2px;
    classDef core fill:#D1FFD1,stroke:#333,stroke-width:2px;
    classDef dependency fill:#FFE6CC,stroke:#333,stroke-width:2px;
    classDef deployment fill:#FFF2CC,stroke:#333,stroke-width:2px;
    classDef remote fill:#FFD1DC,stroke:#333,stroke-width:2px;

    %% Click Events for evil-winrm.rb components
    click CLI "https://github.com/vedattascier/evil-winrm/blob/master/evil-winrm.rb"
    click WH "https://github.com/vedattascier/evil-winrm/blob/master/evil-winrm.rb"
    click PL "https://github.com/vedattascier/evil-winrm/blob/master/evil-winrm.rb"
    click CP "https://github.com/vedattascier/evil-winrm/blob/master/evil-winrm.rb"
    click AU "https://github.com/vedattascier/evil-winrm/blob/master/evil-winrm.rb"

    %% Click Events for External Dependencies
    click GF1 "https://github.com/vedattascier/evil-winrm/tree/master/Gemfile"
    click GF2 "https://github.com/vedattascier/evil-winrm/blob/master/Gemfile.lock"
    
    %% Click Event for Docker Container
    click DO "https://github.com/vedattascier/evil-winrm/tree/master/Dockerfile"
```
