This project demonstrates how to securely execute Python code using a C-based launcher and PyArmor-based encryption.
.
├── main_launcher.c # Main entry point written in C
├── logic.py # Python function file (optionally encrypted via PyArmor)
└── .gitignoremain_launcher.cuses the Python C API to import and run functions fromlogic.pylogic.pyis encrypted using PyArmor 7.x to prevent source code exposurelauncher.exeis built using gcc and links to Python 3.10
- C-based launcher: Execution starts in compiled C code, making the flow harder to reverse-engineer
- PyArmor encryption: Python code is AES-encrypted and decrypted only at runtime
- Runtime isolation: Logic and execution are split to maximize protection
gcc main_launcher.c -o launcher.exe -IC:/Path/To/Python310/include -LC:/Path/To/Python310/libs -lpython310
Example for my system:
gcc main_launcher.c -o launcher.exe -IC:\Users\BK\AppData\Local\Programs\Python\Python310\include -LC:\Users\BK\AppData\Local\Programs\Python\Python310\libs -lpython310- Use Python 3.10 virtual environment:
py -3.10 -m venv pyarmor-env
.\pyarmor-env\Scripts\activate
pip install "pyarmor<8"- Obfuscate:
pyarmor obfuscate logic.py- Move the following to the same folder as launcher.exe:
dist/logic.py
pytransform/📦 SecureApp/
├── launcher.exe
├── logic.py # Encrypted
└── pytransform/ # Runtime
Made by Ellie Eunsung Roh for secure on-device AI code distribution and reverse engineering resistance.