Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Stop Python exe script from converting back

For example, I have a Python file like this:

print("Hello World")

Now I am converting it to an .exe file using pyinstaller.

But I found a method to convert it back:

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

Use pyinstxtractor.py:

python pyinstxtractor.py yourFileName.exe
This will extract .exe and create a folder named yourFileName.exe_extracted.

Inside the yourFileName.exe_extracted folder, find the file without
any extension.

Edit it with HxD editor and from any pycache file created with the
same version of Python, copy the first row and insert it into your
file.

Save and Rename the file with .pyc extension.

Decompile the compiled bytecode (.pyc) to .py using any online tool,
like https://www.toolnb.com/tools-lang-en/pyc.html

Is there any way to prevent converting the .exe file converting back to his .py file?

Thanks.

>Solution :

You can use an obfuscation tool such as PyArmor and add at-least some level of code-protection to your original python script.

The official documentation of PyArmor has more info on this here https://pyarmor.readthedocs.io/en/latest/advanced.html#bundle-obfuscated-scripts-to-one-executable-file

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading