How vedattascier/evil-winrm works
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.).