简体   繁体   中英

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:

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.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM