2

I have created python desktop software. Now I want to market that as a product. But my problem is, anyone can decompile my exe file and they will get the actual code.

So is there any way to encrypt my code and convert it to exe before deployment. I have tried different ways. But nothing is working. Is there any way to do that?.Thanks in advance

  • look at https://stackoverflow.com/questions/3344115/how-to-obfuscate-python-code-effectively – Nearoo Mar 05 '21 at 11:12

2 Answers2

1

This link has most of the info you need. But since links are discouraged here:

There is py2exe, which compiles your code into an .exe file, but afaik it's not difficult to reverse-engineer the code from the exe file.

You can of course make your code more difficult to understand. Rename your classes, functions to be non-sensical (e.g. rename print(s) to delete(s) or to a()) people will have a difficult time then.

You can also avoid all of that by using SaaS (Software as a Service), where you can host your code online on a server and get paid by people using it.

Or consider open-sourcing it :)

0

You can install pyinstaller per pip install pyinstaller (make sure to also add it to your environment variables) and then open shell in the folder where your file is (shift+right-click somewhere where no file is and "open PowerShell here") and the do "pyinstaller --onefile YOUR_FILE".

If there will be created a dist folder, take out the exe file and delete the build folder and the .spec I think it is.

And there you go with your standalone exe File.

FileX
  • 773
  • 2
  • 7
  • 19
  • Yes i did this way. Then i can decompile that exe right?. Which means anyone can get my code.Am i right – Abhijith Abhi Mar 05 '21 at 11:17
  • 1
    Yes. So what pyinstaller will do, is to unzip the .exe into a temp folder. If you know this, you just need to find that temp folder and then you will have access to all your files. – Joao Antunes Aug 25 '21 at 16:15