myph-v2.git


myph-v2

~ rust shellcode loader with evasive capabilities
git clone https://github.com/djnnvx/myph-v2.git
log | files | refs | archive | README

README.md (22669B)

      1 # myph-v2
      2 
      3 > A modern Rust-based shellcode loader framework with multiple injection techniques and evasion capabilities for Windows environments.
      4 
      5 [![CI](https://github.com/djnnvx/myph-v2/workflows/CI/badge.svg)](https://github.com/djnnvx/myph-v2/actions)
      6 [![Rust Version](https://img.shields.io/badge/rust-1.92.0-orange.svg)](https://www.rust-lang.org/)
      7 
      8 In loving memory of **Vasyl Slipak** (1974 - 2016) - [Wikipedia](https://en.wikipedia.org/wiki/Vasyl_Slipak)
      9 
     10 ---
     11 
     12 ## Disclaimer
     13 
     14 This tool is designed for **security research and authorized penetration testing only**. Users are responsible for complying with applicable laws and regulations. Misuse of this software for unauthorized access or malicious purposes is strictly prohibited.
     15 
     16 ---
     17 
     18 ## Overview
     19 
     20 **myph-v2** is a sophisticated shellcode loader generator that creates highly evasive Windows executables, DLLs, and shortcut files. It combines multiple injection techniques, encryption algorithms, and anti-analysis features to generate payloads that can bypass modern security solutions.
     21 
     22 ### Key Capabilities
     23 
     24 - **7 Encryption Algorithms**: AES-128, AES-256, ChaCha20, Twofish, Camellia-256, Blowfish, and XOR with automatic key derivation
     25 - **17 Injection Techniques**: From classic CreateRemoteThread to advanced syscalls, process hollowing, module stomping, and callback-based execution
     26 - **Triple Output Formats**: Generate PE executables (.exe), DLLs (.dll), and Windows shortcuts (.lnk) with cross-platform support
     27 - **Evasion Features**: API hammering, AMSI patching, string encryption, dynamic function resolution, anti-VM, anti-sandbox, and anti-debugger detection
     28 - **Binary Optimization**: Automatic symbol stripping and size optimization
     29 - **Cross-Compilation**: Build Windows binaries from Linux/macOS
     30 
     31 ---
     32 
     33 ## Table of Contents
     34 
     35 - [Prerequisites](#prerequisites)
     36 - [Installation](#installation)
     37 - [Features](#features)
     38 - [Usage](#usage)
     39 - [Injection Techniques](#injection-techniques)
     40 - [Encryption Methods](#encryption-methods)
     41 - [Low-Resource Build Mode](#low-resource-build-mode)
     42 - [Development](#development)
     43 - [CI/CD](#cicd)
     44 - [Architecture](#architecture)
     45 - [Troubleshooting](#troubleshooting)
     46 - [Contributing](#contributing)
     47 - [Legal Notice](#legal-notice)
     48 - [Contact](#contact)
     49 
     50 ---
     51 
     52 ## Prerequisites
     53 
     54 - **Rust**: Version 1.92.0 or later ([rustup.rs](https://rustup.rs/))
     55 - **MinGW-w64**: For cross-compilation to Windows (Linux/macOS only)
     56 - **NASM**: Required when using `--with-callstack-spoofing` (build-time dependency for UWD library)
     57 
     58 ---
     59 
     60 ## Installation
     61 
     62 ### Installation
     63 
     64 ```bash
     65 # Install Rust
     66 curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
     67 
     68 # Linux/macOS: Install cross-compilation tools
     69 sudo apt-get install -y mingw-w64  # Debian/Ubuntu
     70 brew install mingw-w64              # macOS
     71 rustup target add x86_64-pc-windows-gnu
     72 
     73 # Install NASM (optional - only needed if using --with-callstack-spoofing)
     74 sudo apt-get install -y nasm        # Debian/Ubuntu
     75 brew install nasm                   # macOS
     76 
     77 # Clone and build
     78 git clone https://github.com/djnnvx/myph-v2.git
     79 cd myph-v2
     80 cargo build --release
     81 
     82 # Verify
     83 cargo test
     84 ./target/release/myph_v2 --help
     85 ```
     86 
     87 ---
     88 
     89 ## Features
     90 
     91 ### Encryption Methods
     92 
     93 | Algorithm | Key Size | Security Level |
     94 |-----------|----------|----------------|
     95 | **AES-128** | 128-bit | High |
     96 | **AES-256** | 256-bit | High |
     97 | **ChaCha20** | 256-bit | High |
     98 | **Twofish** | 256-bit | High |
     99 | **Camellia-256** | 256-bit | High |
    100 | **Blowfish** | 32-448 bit | Medium-High |
    101 | **XOR** | Variable | Basic |
    102 
    103 All methods (except XOR) use SHA-256 key derivation with random IV/nonce generation.
    104 
    105 ### Technique Capability Matrix
    106 
    107 | Technique | Detection Difficulty | Admin Required | Process Injection | Requires Ntdll |
    108 |-----------|---------------------|----------------|-------------------|----------------|
    109 | crt | Medium |  | ✓ |  |
    110 | crtx | Medium |  | ✓ |  |
    111 | create-fiber | Medium-High |  | Local |  |
    112 | process-hollowing | High |  | ✓ | ✓ |
    113 | nt-create-thread-ex | Medium-High |  | ✓ | ✓ |
    114 | syscall | Medium |  | Local | ✓ |
    115 | etwp | High |  | Local |  |
    116 | set-timer | High |  | Local |  |
    117 | enum-calendar | High |  | Local |  |
    118 | enum-windows | High |  | Local |  |
    119 | enum-system-locales | High |  | Local |  |
    120 | image-get-digest-stream | High |  | Local |  |
    121 | queue-user-apc | High |  | Local |  |
    122 | fairy-law | Very High | ✓ | Local |  |
    123 | module-stomping | Very High |  | Local |  |
    124 | thread-hijacking | Very High |  | ✓ |  |
    125 | early-bird | Very High |  | ✓ |  |
    126 
    127 **Legend:**
    128 - **Admin Required**: Technique requires administrator privileges
    129 - **Process Injection**: ✓ = Injects into remote process, Local = Executes locally
    130 - **Requires Ntdll**: Uses native NT API functions from ntdll.dll
    131 
    132 **Note:** All techniques are compatible with AMSI patching (`--with-amsi-patch`), call stack spoofing (`--with-callstack-spoofing`, requires NASM), and dynamic function resolver (`--with-dynamic-function-resolver`).
    133 
    134 **Compatibility Check:**
    135 ```bash
    136 # Check if a technique is compatible with your selected features
    137 myph_v2 --technique <technique> --check-compatibility
    138 
    139 # Example: Check if crt works with dynamic resolver
    140 myph_v2 --technique crt --process notepad.exe --with-dynamic-function-resolver --check-compatibility
    141 ```
    142 
    143 ### Output Formats
    144 
    145 - **EXE**: Standalone Windows executables
    146 - **DLL**: Dynamic libraries with DllMain execution
    147 - **LNK**: Windows shortcut files (PowerShell-based execution)
    148 
    149 ---
    150 
    151 ## Usage
    152 
    153 ### Quick Start
    154 
    155 ```bash
    156 myph_v2 -s shellcode.raw -f output.exe -e aes -t crt
    157 ```
    158 
    159 ### Common Examples
    160 
    161 ```bash
    162 # Process injection with custom target
    163 myph_v2 -s payload.bin -f injector.exe -e aes -t process-hollowing -p notepad.exe
    164 
    165 # DLL with evasion features
    166 myph_v2 -s payload.bin -f loader.dll -b dll -e chacha20 -t crtx -p explorer.exe \
    167   --with-api-hammering --with-amsi-patch
    168 
    169 # LNK file for social engineering (PowerShell-based)
    170 myph_v2 -s payload.bin -f document.lnk -b lnk -e aes -t create-fiber
    171 
    172 # Callback execution (no injection)
    173 myph_v2 -s payload.bin -f callback.exe -e xor -t enum-calendar --with-amsi-patch
    174 
    175 # Maximum evasion
    176 myph_v2 -s payload.bin -f evasive.exe -e aes -t syscall \
    177   --with-string-encryption --with-dynamic-function-resolver --with-amsi-patch
    178 ```
    179 
    180 ### Options
    181 
    182 ```
    183 Required:
    184   -s, --shellcode <FILE>      Path to raw shellcode file
    185 
    186 Output:
    187   -f, --out <FILE>            Output name [default: out.exe]
    188   -b, --binary-format <FMT>   Format: exe, dll, lnk [default: exe]
    189 
    190 Encryption:
    191   -e, --encryption <TYPE>     Method: aes, aes256, chacha20, twofish, camellia, xor, blowfish [default: aes]
    192   -k, --key <KEY>             Encryption key (auto-generated if omitted)
    193 
    194 Injection:
    195   -t, --technique <TECH>      Technique [default: crt]
    196   -p, --process <PROC>        Target process [default: cmd.exe]
    197 
    198 Evasion:
    199   --with-api-hammering        Enable CPU/IO operations
    200   --with-amsi-patch           Bypass AMSI
    201   --with-string-encryption    Encrypt strings at compile-time
    202   --with-dynamic-function-resolver
    203                               Runtime API resolution via PEB walk
    204   --with-anti-vm              Enable anti-VM detection checks
    205   --with-anti-sandbox         Enable anti-sandbox detection checks
    206   --with-anti-debugger        Enable anti-debugger detection checks
    207   --with-callstack-spoofing   Enable call stack spoofing (requires NASM)
    208 
    209 Build:
    210   --low-resources             Use low-resource build profile (for VMs with limited RAM)
    211 ```
    212 
    213 ---
    214 
    215 ## Injection Techniques
    216 
    217 ### Process Injection (requires `-p`)
    218 
    219 ```bash
    220 # CreateRemoteThread
    221 myph_v2 -s sc.raw -t crt -p notepad.exe
    222 
    223 # NtCreateThreadEx (native API)
    224 myph_v2 -s sc.raw -t nt-create-thread-ex -p svchost.exe
    225 
    226 # Process Hollowing
    227 myph_v2 -s sc.raw -t process-hollowing -p cmd.exe
    228 
    229 # Thread Hijacking (suspend, modify context, resume)
    230 myph_v2 -s sc.raw -t thread-hijacking -p explorer.exe
    231 
    232 # Early Bird APC (inject before main thread starts)
    233 myph_v2 -s sc.raw -t early-bird -p notepad.exe
    234 ```
    235 
    236 ### Local Execution
    237 
    238 ```bash
    239 # Fiber-based
    240 myph_v2 -s sc.raw -t create-fiber
    241 
    242 # Module Stomping (overwrite legitimate DLL)
    243 myph_v2 -s sc.raw -t module-stomping
    244 
    245 # Callback-based
    246 myph_v2 -s sc.raw -t enum-calendar
    247 myph_v2 -s sc.raw -t image-get-digest-stream
    248 
    249 # Direct syscall
    250 myph_v2 -s sc.raw -t syscall
    251 ```
    252 
    253 ### Fairy-Law: EDR Evasion via MicrosoftSignedOnly Policy
    254 
    255 **Fairy-Law** enables the Windows `MicrosoftSignedOnly` mitigation policy to prevent EDR components from loading. Named after the spell in Fairy Tail anime that only affects enemies while leaving allies unharmed, this technique causes Windows to treat only Microsoft-signed DLLs as "allies" and block all others as "enemies" - including legitimate EDR vendor DLLs.
    256 
    257 **How It Works:**
    258 
    259 EDR solutions typically rely on user-mode DLLs (monitoring modules, telemetry collectors, support libraries) signed by the vendor or third-party CAs. When `MicrosoftSignedOnly` is enabled:
    260 
    261 1. Windows enforces that **ONLY** Microsoft-signed DLLs may be loaded
    262 2. Vendor-signed EDR DLLs are rejected by the OS
    263 3. EDR agents fail to initialize their user-mode components
    264 4. Telemetry, monitoring, and anti-tamper systems do not start
    265 5. Policy is applied at kernel Phase 0 and **cannot be refreshed at runtime**
    266 
    267 **Requirements:**
    268 
    269 - Must be run with Administrator privileges
    270 - System restart required after enabling policy
    271 - Operator must manually handle all steps
    272 
    273 **Usage:**
    274 
    275 ```bash
    276 # Generate the binary
    277 myph_v2 -s sc.raw -t fairy-law -e aes
    278 
    279 # With evasion features
    280 myph_v2 -s sc.raw -t fairy-law -e chacha20 --with-dynamic-function-resolver
    281 ```
    282 
    283 **Operator Workflow:**
    284 
    285 ```bash
    286 # Step 1: Run as Administrator on target (first execution)
    287 runas /user:Administrator fairy_law.exe
    288 # Output: "MicrosoftSignedOnly policy enabled successfully!"
    289 # Output: "EDR components will be blocked after restart."
    290 
    291 # Step 2: Restart the system manually
    292 shutdown /r /t 0
    293 
    294 # Step 3: After restart, EDR fails to load vendor DLLs
    295 # Binary auto-runs from startup (or run again manually)
    296 # Payload executes with EDR disabled
    297 
    298 # Step 4: Verify EDR failure (optional)
    299 # EDR agents will show errors in Event Viewer:
    300 # "The application was unable to start correctly... DLL is not signed by Microsoft"
    301 ```
    302 
    303 **Technical Details:**
    304 
    305 - Modifies: `HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Kernel\MitigationOptions`
    306 - Sets MicrosoftSignedOnly bit: `0x00, 0x01, 0x00, 0x00...`
    307 - Adds persistence: `HKCU\Software\Microsoft\Windows\CurrentVersion\Run`
    308 - Policy applies system-wide at next boot during kernel initialization
    309 
    310 **Detection Difficulty:**
    311 
    312 - EDR logs will show DLL load failures (after it's too late)
    313 - No suspicious process behavior
    314 
    315 **Warning:**
    316 
    317 This technique:
    318 - Requires Administrator privileges (no automatic UAC)
    319 - Modifies system-level security settings
    320 - Requires manual system restart
    321 - Blocks ALL non-Microsoft DLLs system-wide (may break some applications)
    322 - Operator must manually remove policy after testing
    323 
    324 ---
    325 
    326 ### LNK Format: Windows Shortcut Delivery
    327 
    328 **LNK (Windows Shortcut)** files provide an alternative delivery mechanism using PowerShell-based shellcode execution.
    329 **They can be generated on Linux/macOS build environments** without requiring PowerShell to be installed.
    330 
    331 **How It Works:**
    332 
    333 1. Generates a PowerShell script with embedded base64-encoded encrypted shellcode
    334 2. Creates an LNK file that points to PowerShell with hidden window style
    335 3. When user double-clicks the LNK file, PowerShell executes the script
    336 4. Script decrypts shellcode and executes it in memory
    337 
    338 **Usage:**
    339 
    340 ```bash
    341 # Basic LNK generation
    342 myph_v2 -s payload.bin -f document.lnk -b lnk -e aes
    343 
    344 # With encryption and evasion
    345 myph_v2 -s payload.bin -f report.lnk -b lnk -e chacha20 --with-string-encryption
    346 
    347 # Different techniques
    348 myph_v2 -s payload.bin -f file.lnk -b lnk -e xor -t syscall
    349 myph_v2 -s payload.bin -f setup.lnk -b lnk -e aes256 -t create-fiber
    350 ```
    351 
    352 **Limitations:**
    353 
    354 - PowerShell execution policy must allow script execution
    355 - Process injection techniques run as local execution (fallback)
    356 - Script Execution Policy Bypass used (`-ExecutionPolicy Bypass`)
    357 - AV/EDR may monitor PowerShell execution
    358 
    359 **Technical Details:**
    360 
    361 - LNK target: `C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe`
    362 - Arguments: `-WindowStyle Hidden -ExecutionPolicy Bypass -NoProfile -File <script>`
    363 - PowerShell script stored in: `%TEMP%\payload_<UUID>.ps1`
    364 - Shellcode: Base64-encoded, decrypted at runtime
    365 - Memory allocation: PowerShell's `[System.Runtime.InteropServices.Marshal]`
    366 - Icon: Uses `shell32.dll` (customizable)
    367 
    368 **Detection Difficulty:**
    369 
    370 - AV/EDR may flag suspicious PowerShell behavior
    371 - Consider using `--with-string-encryption` for better evasion
    372 
    373 ---
    374 
    375 ## Encryption Methods
    376 
    377 ```bash
    378 # AES-128 (hardware accelerated)
    379 myph_v2 -s sc.raw -e aes -k "MyPassword"
    380 
    381 # AES-256 (strongest AES)
    382 myph_v2 -s sc.raw -e aes256 -k "MyPassword"
    383 
    384 # ChaCha20 (fast, no side-channels)
    385 myph_v2 -s sc.raw -e chacha20 -k "StreamKey"
    386 
    387 # Twofish (AES finalist, highly secure)
    388 myph_v2 -s sc.raw -e twofish -k "TwofishKey"
    389 
    390 # Camellia-256 (international standard)
    391 myph_v2 -s sc.raw -e camellia -k "CamelliaKey"
    392 
    393 # Blowfish (proven, variable key)
    394 myph_v2 -s sc.raw -e blowfish -k "BlowKey"
    395 
    396 # XOR (fast, testing only)
    397 myph_v2 -s sc.raw -e xor -k "SimpleKey"
    398 ```
    399 
    400 ### String Encryption
    401 
    402 Encrypts string literals at compile-time, decrypts at runtime:
    403 
    404 ```bash
    405 myph_v2 -s sc.raw -e aes --with-string-encryption
    406 ```
    407 
    408 ### Dynamic Function Resolution
    409 
    410 Runtime API resolution via PEB walk eliminates static IAT entries:
    411 
    412 ```bash
    413 myph_v2 -s sc.raw -e xor --with-dynamic-function-resolver -t create-fiber
    414 ```
    415 
    416 **Benefits:**
    417 - No static IAT entries
    418 - Encrypted function names
    419 - Defeats static analysis
    420 - Works with all techniques
    421 
    422 ### Anti-Analysis Detection
    423 
    424 Detect and evade virtual machines, sandboxes, and debuggers before execution:
    425 
    426 ```bash
    427 # Anti-VM detection (checks VM artifacts, processes, registry)
    428 myph_v2 -s sc.raw -e aes -t create-fiber --with-anti-vm
    429 
    430 # Anti-sandbox detection (checks timing, user interaction, resources)
    431 myph_v2 -s sc.raw -e aes -t syscall --with-anti-sandbox
    432 
    433 # Anti-debugger detection (checks debugger presence, breakpoints)
    434 myph_v2 -s sc.raw -e aes -t enum-calendar --with-anti-debugger
    435 
    436 # Combine multiple evasion techniques
    437 myph_v2 -s sc.raw -e aes -t module-stomping \
    438   --with-anti-vm --with-anti-sandbox --with-anti-debugger \
    439   --with-amsi-patch --with-string-encryption
    440 ```
    441 
    442 ### Call Stack Spoofing
    443 
    444 **Call stack spoofing** uses the [UWD library](https://github.com/joaoviictorti/uwd) to forge call stacks when executing Windows API calls, making execution appear as if it originated from legitimate system components. This evades analysis, logging, and detection mechanisms that inspect call stacks during execution.
    445 
    446 **How It Works:**
    447 
    448 When enabled, the UWD library intercepts API calls and manipulates the call stack to:
    449 1. Create synthetic stack frames pointing to legitimate system DLLs
    450 2. Hide the actual origin of API calls from stack walkers
    451 3. Bypass security solutions that rely on call stack inspection
    452 4. Support both normal API calls and indirect syscalls
    453 
    454 **Requirements:**
    455 
    456 - NASM (Netwide Assembler) must be installed at build time
    457 - Windows x64 target only
    458 - Compatible with both MSVC and GNU toolchains
    459 
    460 **Usage:**
    461 
    462 ```bash
    463 # Basic call stack spoofing
    464 myph_v2 -s sc.raw -e aes -t create-fiber --with-callstack-spoofing
    465 
    466 # Combined with dynamic function resolver for maximum evasion
    467 myph_v2 -s sc.raw -e chacha20 -t syscall \
    468   --with-callstack-spoofing --with-dynamic-function-resolver
    469 
    470 # Process injection with spoofed call stacks
    471 myph_v2 -s sc.raw -e aes -t nt-create-thread-ex -p notepad.exe \
    472   --with-callstack-spoofing --with-amsi-patch
    473 
    474 # Maximum evasion configuration
    475 myph_v2 -s sc.raw -e aes256 -t early-bird -p explorer.exe \
    476   --with-callstack-spoofing \
    477   --with-dynamic-function-resolver \
    478   --with-string-encryption \
    479   --with-amsi-patch \
    480   --with-anti-vm \
    481   --with-anti-sandbox \
    482   --with-anti-debugger
    483 ```
    484 
    485 **Installation:**
    486 
    487 ```bash
    488 # Ubuntu/Debian
    489 sudo apt-get install -y nasm
    490 
    491 # macOS
    492 brew install nasm
    493 
    494 # Verify installation
    495 nasm --version
    496 ```
    497 
    498 **Technical Details:**
    499 
    500 - Uses [UWD v0.3.5](https://github.com/joaoviictorti/uwd)
    501 - Inspired by [SilentMoonwalk](https://github.com/klezVirus/SilentMoonwalk)
    502 - Supports both Synthetic and Desync spoofing modes
    503 - Automatic gadget resolution for stack manipulation
    504 - No-std compatible with alloc support
    505 
    506 ---
    507 
    508 **Detection Methods:**
    509 - **Anti-VM**: VM DLLs, processes, registry keys, CPU/memory limits, firmware
    510 - **Anti-Sandbox**: Timing analysis, file system checks, uptime, user activity
    511 - **Anti-Debugger**: IsDebuggerPresent, remote debugger, debug port, hardware breakpoints
    512 
    513 ---
    514 
    515 ## Low-Resource Build Mode
    516 
    517 When running myph-v2 on VMs or systems with limited RAM, the standard build profile may cause out-of-memory errors due to cargo's aggressive optimization settings. The `--low-resources` flag enables a more memory-efficient build profile.
    518 
    519 ### Standard vs Low-Resource Profile
    520 
    521 | Setting | Standard | Low-Resource |
    522 |---------|----------|--------------|
    523 | LTO | Full (`true`) | Thin (`"thin"`) |
    524 | Codegen Units | 1 | 16 |
    525 | Opt Level | `"z"` (size) | `"s"` (moderate) |
    526 | Parallel Jobs | Unlimited | 2 |
    527 
    528 ### Usage
    529 
    530 ```bash
    531 # Enable low-resource mode
    532 myph_v2 -s payload.bin -f output.exe -e aes -t create-fiber --low-resources
    533 
    534 # Combine with other options
    535 myph_v2 -s payload.bin -f output.exe -e chacha20 -t syscall \
    536   --with-string-encryption --low-resources
    537 ```
    538 
    539 ### Tradeoffs
    540 
    541 - **Binary size**: ~10-30% larger than standard profile
    542 - **Build time**: May be faster due to parallelization
    543 - **Memory usage**: Significantly reduced during compilation
    544 - **Runtime performance**: Negligible difference for typical shellcode loaders
    545 
    546 Use this flag when building on resource-constrained environments (VMs, CI runners, containers).
    547 
    548 ---
    549 
    550 ## Development
    551 
    552 ### Building
    553 
    554 ```bash
    555 cargo build              # Debug build
    556 cargo build --release    # Optimized build
    557 cargo run -- -s shellcode.raw -f out.exe
    558 ```
    559 
    560 ### Testing
    561 
    562 ```bash
    563 cargo test                    # All tests
    564 cargo test -- --nocapture     # With output
    565 cargo test encryption::       # Specific module
    566 ```
    567 
    568 ### Code Quality
    569 
    570 ```bash
    571 cargo fmt --check    # Check formatting
    572 cargo fmt            # Format code
    573 cargo clippy --all-targets --all-features -- -D warnings
    574 cargo check          # Fast compile check
    575 ```
    576 
    577 ### Debug Mode
    578 
    579 Enable code generation debug markers with the `MYPH_DEBUG_CODEGEN` environment variable:
    580 
    581 ```bash
    582 MYPH_DEBUG_CODEGEN=1 ./myph_v2 -s shellcode.raw -f output.exe -e aes
    583 ```
    584 
    585 This adds helpful comments to the generated code showing technique names and code sections:
    586 ```rust
    587 // === Technique: CreateFiber ===
    588 // --- Imports & Declarations ---
    589 // --- Constants ---
    590 // --- Main Implementation ---
    591 ```
    592 
    593 Useful for debugging code generation issues. Has no effect on production builds (comments are removed during compilation).
    594 
    595 ---
    596 
    597 ## CI/CD
    598 
    599 GitHub Actions runs on every push to `stable`:
    600 
    601 1. **Check**: `cargo check --verbose`
    602 2. **Test**: `cargo test --verbose` (unit tests)
    603 3. **Format**: `cargo fmt -- --check`
    604 4. **Clippy**: `cargo clippy --all-targets --all-features -- -D warnings`
    605 5. **E2E Test**: Validates all 13 techniques, 7 encryption methods, and features
    606 6. **Build**: `cargo build --release --verbose`
    607 7. **Windows Integration**: Unit tests for PEB walk and API resolution
    608 8. **Windows E2E**: Build myph-v2, generate binaries with NOP shellcode, and verify execution
    609 
    610 Run locally:
    611 ```bash
    612 cargo check && cargo test && cargo fmt --check && \
    613 cargo clippy --all-targets --all-features -- -D warnings && \
    614 cargo build --release
    615 ```
    616 
    617 ---
    618 
    619 ## Architecture
    620 
    621 ### Code Generation Pipeline
    622 
    623 ```
    624 CLI Input → Parse Options → Encrypt Shellcode → Generate Rust Project
    625 → Cargo Build (optimized, stripped) → Verify Binary → Copy to Output
    626 ```
    627 
    628 ### Design Principles
    629 
    630 - **Code Generation**: Creates temporary Rust projects for optimal compilation
    631 - **Encryption**: Proper cryptographic practices with SHA-256 key derivation
    632 - **Builder Pattern**: Type-safe, fluent API for configuration
    633 
    634 ---
    635 
    636 ## Troubleshooting
    637 
    638 ### Build Issues
    639 
    640 **`linker 'x86_64-w64-mingw32-gcc' not found`**
    641 ```bash
    642 # Install MinGW-w64
    643 sudo apt-get install mingw-w64  # Debian/Ubuntu
    644 brew install mingw-w64           # macOS
    645 rustup target add x86_64-pc-windows-gnu
    646 ```
    647 
    648 **`Failed to read shellcode file`**
    649 ```bash
    650 ls -lh shellcode.raw    # Verify file exists
    651 chmod +r shellcode.raw  # Fix permissions
    652 ```
    653 
    654 **`Failed to compile with NASM` when using --with-callstack-spoofing**
    655 ```bash
    656 # Install NASM (required for UWD library)
    657 sudo apt-get install -y nasm  # Debian/Ubuntu
    658 brew install nasm             # macOS
    659 
    660 # Verify installation
    661 nasm --version
    662 ```
    663 
    664 ### Runtime Issues
    665 
    666 **Generated binary won't execute on Windows**
    667 - Check Windows Defender/AV isn't quarantining
    668 - Verify correct architecture (x64): `file output.exe`
    669 - Try running as Administrator for injection techniques
    670 
    671 **Injection fails with "Access Denied"**
    672 - Run as Administrator
    673 - Target less-protected process (e.g., notepad.exe)
    674 - Try different injection technique
    675 
    676 ---
    677 
    678 ## Contributing
    679 
    680 ### Adding a New Technique
    681 
    682 To add a new injection technique:
    683 
    684 1. Create `src/internals/templates/techniques/new_technique.rs` with the standard pattern:
    685    ```rust
    686    pub fn new_technique_import() -> String { /* imports */ }
    687    pub fn new_technique_const() -> String { /* constants/externs */ }
    688    pub fn new_technique_init() -> String { /* init code */ }
    689    pub fn new_technique_process() -> String { /* main logic */ }
    690    pub fn generate_new_technique_code(function_name: &str) -> String { /* static version */ }
    691    pub struct NewTechniqueGenerator;
    692    impl TechniqueGenerator for NewTechniqueGenerator { /* trait impl */ }
    693    ```
    694 
    695 2. Use centralized externs from `common.rs` - don't duplicate `VirtualAlloc`, `VirtualProtect`, etc.
    696 
    697 3. Use helpers from `codegen_helpers.rs` for common patterns like `MemoryAllocationBuilder`
    698 
    699 4. Export in `mod.rs`:
    700    ```rust
    701    pub mod new_technique;
    702    pub use new_technique::NewTechniqueGenerator;
    703    ```
    704 
    705 5. Add unit tests and E2E tests in `.github/workflows/ci.yml`
    706 
    707 6. Update the technique table in this README
    708 
    709 ---
    710 
    711 ## Legal Notice
    712 
    713 This tool is provided for educational and authorized security testing purposes only. The authors and contributors are not responsible for misuse or illegal activities conducted with this software. Always obtain explicit written permission before testing against systems you do not own.
    714 
    715 ---
    716 
    717 ## Contact
    718 
    719 For suggestions or questions, please contact the author directly at [https://djnn.sh](https://djnn.sh).
    720 
    721 ---
    722 
    723 **Made with care by djnn**