Tool/Library for Python used to obfuscate and protect your code from decompilation, reverse debug, etc. Also, can prevent detection by antiviruses.
- Python 3
- Windows
- Various Linux distributions
- Mac OS
Hash strings
- Hashing all strings in piece of code. It replaces all strings with their hash.
- Protects strings context.
Looping obfuscation
- Encrypting piece of code using base64 and zlib for N times.
- Best way to decrease/prevent antiviruses detection.
AES encryption
- Encrypting piece of code using AES 256 encryption algorithm.
- One of two nice ways to protect code from deobfuscation.
Fernet encryption
- Encrypting piece of code using Fernet encryption algorithm.
- One of two nice ways to protect code from deobfuscation.
- Clone repo
git clone https://github.com/ByteCorum/Py-Shield.git
- Install requirements
pip install -r requirements.txt
- More info
py-shield --help
- Example
py-shield --mode hashstr;crypt;looping;aes --loops 3 main.py
- Output
from PyShield.script_67158430 import PyShield PyShield(__file__, b'x\x9c\x05\xc1I\xa2C0\x00\x00\xd0\x03Y\x18\xf0Q\xc4\\;TEM\r...')
- Example legacy
py-shield-legacy --loops 3 --mode 2 --file main.py
- Output legacy
_=lambda __:__import__('zlib').decompress(__import__('cryptography.fernet').fernet.Fernet(((__import__('zlib').decompress(__))[::-1].split(b'/%p@K^(Y#C/_/jUEIakSX%/'))[1]).decrypt(((__import__('zlib').decompress(__))[::-1].split(b'/%p@K^(Y#C/_/jUEIakSX%/'))[0])[::-1]);exec((_)(b'x\x9c\x15\x...')
Note
Obfuscation tool has 2 major versions legacy and global. This repo includes both of them, but we highly recommend you to use the global version, cut it much securer. Anyway, we won't end support of legacy version, so if u have issues, let us know.
Tip
We highly recommend compiling obfuscated script using Nuitka. Use --follow imports
while obfuscating to tell Nuitka what to import