A Python utility that applies configurable layers of encryption and compression to a PowerShell script, producing an obfuscated payload with a self-contained decoding stub.
- Fernet symmetric encryption per obfuscation layer
- Chained Base64 encoding, zlib, and gzip compression
- Auto-generated PowerShell decoder stub that reverses the process and executes the original script
- Configurable layer count
- Python 3.10+
cryptography
pip install -r requirements.txtpython main.py <script.ps1> [-l LAYERS] [-o OUTPUT]| Argument | Description | Default |
|---|---|---|
<script.ps1> |
Path to the input PowerShell script | — |
-l, --layers |
Number of obfuscation layers | 3 |
-o, --output |
Output file path | obfuscated.ps1 |
Example
python main.py examples/sample.ps1 -l 4 -o out.ps1- Reads the input
.ps1script - For each layer: generates a fresh Fernet key, encrypts the payload, then applies Base64 → zlib → gzip compression
- Bundles all keys and the encoded payload into a PowerShell decoder stub
- Writes the final script to the output path
The generated script embeds decryption keys inline. This tool is intended for legitimate use cases such as payload testing and AV evasion research in authorized environments. Do not use it against systems you do not own or have explicit permission to test.