Skip to main content

MimicShield 🛡️

Advanced Polymorphic Python Script Protector, Bytecode Obfuscator & Execution Shield

PyPI - Version Python Versions License: MIT

MimicShield (mimic-shield) is a multi-layered Python script protection framework developed as a collaborative 4-person engineering project. Unlike standard packers that simply base64-encode strings, MimicShield compiles your Python source into compiled AST bytecode, compresses it through dual-stage LZMA/zlib algorithms, seals it with an HMAC-SHA256 integrity checksum, and executes directly in memory using a rolling XOR polymorphic loader.


👥 4-Person Architecture & Contribution Matrix

This project is cleanly modularized into 4 independent sub-systems, each handled by one dedicated team member:

Member Module Primary Role & Responsibilities
Member 1 mimicpy/encoder.py Core Encryption & Bytecode Serialization
• AST compilation into bytecode (marshal)
• Dual-stage compression (LZMA + zlib)
• Dynamic rolling XOR feedback stream cipher
• Base85 payload armoring
Member 2 mimicpy/verifier.py Anti-Reverse Engineering & Integrity Verification
• Active debugger detection (sys.gettrace, pydevd, ptvsd)
• Delta timing discrepancy checks (anti-stepping)
• HMAC-SHA256 digital signature tamper-seal
• Anti-clock rollback network time validation (HTTP/NTP)
Member 3 mimicpy/generator.py Polymorphic Stub Synthesizer & Obfuscator
• Dynamic identifier generator (memory-offset spoofing)
• Opaque mathematical predicates & dead-code injection
• Direct-to-RAM bytecode loader (zero disk touching)
• Memory frame eradication & variable wiping
Member 4 mimicpy/cli.py CLI Interface & Pipeline Orchestrator
• High-performance CLI argument parser (argparse)
• Interactive terminal interface with banner
• End-to-end pipeline orchestration across all modules
• Compression & payload metric reporting

🔒 Why Reverse Engineering & AI Analysis Fail

Traditional obfuscators fail because they pass plain strings to exec(), which anyone can intercept with print(). MimicShield uses multi-barrier defenses:

  1. No Plaintext Source in Output: The original code is compiled into raw Python bytecode and serialized with marshal. Static deobfuscators and LLMs see only base85 ciphertext.
  2. Anti-Stepping & Breakpoint Defense: If an analyst sets breakpoints in an IDE or runs step-through debuggers, high-precision delta counters detect the execution latency and terminate immediately.
  3. Anti-Tampering HMAC Seal: Modifying even a single character in the payload or attempting to replace variables invalidates the HMAC-SHA256 signature, immediately aborting execution.
  4. Opaque Predicates to Confuse AI Analyzers: Dynamic junk branches and mathematical noise prevent AI reasoning engines and static CFG (Control Flow Graph) builders from tracing execution flow.
  5. Anti-Rollback Time Lock: The expiration mechanism queries external authoritative HTTP/NTP date headers to verify timestamps even if an attacker alters their local system clock.

🚀 Installation

Install via pip:

pip install mimic-shield

Or install locally in editable development mode:

git clone https://github.com/mimicpy/mimicpy.git
cd mimicpy
pip install -e .

💻 Usage

1. Interactive CLI Mode

Simply run the command:

mimic
# or
mimicpy

Follow the prompts:

  1. Enter the target script filename (e.g. main.py).
  2. Select protection preset:
    • Preset 1: High Protection (Anti-Debug + Timing Check + No Expiration).
    • Preset 2: Timed License (High Protection + Set Hard Expiry Date & Time).
    • Preset 3: Custom Protections.

Output is generated as mimic_<script_name>.py.

2. Command Line Automation Mode

For headless builds and automated scripting:

# Basic high-protection armor
mimic -i bot.py -o protected_bot.py

# With network-verified hard expiration
mimic -i bot.py -o protected_bot.py -e "2026-12-31 23:59"

# Without anti-debugging check (e.g. for development testing)
mimic -i bot.py -o protected_bot.py --no-anti-debug

🏗️ Architecture Flow

[Raw Python Script]
       │
       ▼ [Member 1: encoder.py]
  AST Compile ──► Marshal Bytes ──► Dual Compress (LZMA+Zlib) ──► Rolling XOR
       │
       ▼ [Member 2: verifier.py]
  HMAC-SHA256 Seal + Anti-Debug + Timing Probe + Network Expiry Logic
       │
       ▼ [Member 3: generator.py]
  Opaque Predicate Injection + Polymorphic Identifiers + Direct Memory Loader
       │
       ▼ [Member 4: cli.py]
  Assembled Executable: mimic_<script>.py (Direct RAM Execution via marshal.loads)

📜 License

Distributed under the MIT License. See LICENSE for more information.

Metadata

Release files for mimic-shield 1.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for mimic-shield 1.0.0
File Size Uploaded Provenance Actions
mimic_shield-1.0.0.tar.gz 11.0 kB Without provenance Details for mimic_shield-1.0.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for mimic-shield 1.0.0
File Interpreter ABI Platform Actions
mimic_shield-1.0.0-py3-none-any.whl Python 3 none any Details for mimic_shield-1.0.0-py3-none-any.whl

Total release size: 23.6 kB

Release files / mimic_shield-1.0.0.tar.gz

Download URL mimic_shield-1.0.0.tar.gz
Size 11.0 kB
Tags Source
SHA-256 checksum
How to use checksums
84d6ab82346aa069525a7b82b4627c9e61cb42c984c244ba4fb32087acebe0dd
BLAKE2b-256 checksum
How to use checksums
75ac13bc386a0c46c81d143c6d0e019c970497fbe277e66abb1bb3111b6101e3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.4

Release files / mimic_shield-1.0.0-py3-none-any.whl

Download URL mimic_shield-1.0.0-py3-none-any.whl
Size 12.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7069f1cff0291cc4eec0c85f6553ccf75cde545c3219fd6d2f6dc7d1dd9bdc3f
BLAKE2b-256 checksum
How to use checksums
8c094e042af20405e814b8b020410eea5684fcba141942471d53ade49a949212
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.4

Security for mimic-shield 1.0.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page