I need to obfuscate my Python code, I know the best way would be to convert it to a C file but I can't do that.
According to this article, although not 100% effective, I can "obfuscate" the code using:
python -OO -m py_compile <filename.py>
Doing this generates a PYC file, I tried to convert it to Exe using the Pyinstaller doing this:
pyinstaller --onefile filename.pyc
but it doesn't work, how can I then convert the obfuscated Pyc file to Exe? Is there any other way to obfuscate the code and then convert it to Exe without converting it to C language?
From How to Obfuscate Python Scripts With PyArmor:
Install PyArmor:
Obfuscate
script.pywith PyArmor:The original
script.pyfile:After obfuscation:
If you want to also obfuscate the strings, you can specify the
--mix-stroption:In order to package your Python application, you need
pyinstaller:Then run:
In the
distfolder, you will find the obfuscated bundled application to distribute.