1

I would like to distribute a .exe program that I made with Python and py2exe. My program may be commercial (not sure). If so, I don't want people to recover easily the sourcecode. (Of course reverse engineering or complex decompiling can always be done, but...)

So : is it possible to recover the original sourecode from an executable produced by py2exe?

Basj
  • 41,386
  • 99
  • 383
  • 673
  • Linked to https://stackoverflow.com/questions/5497399/can-exe-generated-by-cx-freeze-be-completely-decompiled-back-to-readable-python – Basj Jun 20 '20 at 21:53

1 Answers1

3

Yes, trivially. Py2exe just creates a zip of the .pyc files with an executable wrapper, and those files are easily uncompilable with eg uncompyle.

The way to sell commercial software in Python is not to worry about whether people can see the code, but to license it appropriately.

Daniel Roseman
  • 588,541
  • 66
  • 880
  • 895
  • So there is absolutely no solution for protecting the sourcecode ? The code has nothing special, but there are algorithms in them for which I don't want the (commercial) competitors to re-use so easily... – Basj Dec 06 '13 at 11:01
  • Possible solutions: 1. Don't use Python. 2. Patent your algorithms. 3. Compile to something else? Jython and IronPython? I don't know if that would allow obfuscation. 4. Get a lawyer to sue if they use the algorithms. Add quirks. Use a restrictive license. 5. Don't worry about it. – leewz Dec 06 '13 at 11:19
  • @Basj http://stackoverflow.com/questions/261638/how-do-i-protect-python-code – Prashant Kumar Dec 06 '13 at 20:59
  • You're right @DanielRoseman! I tried again a few days ago, and here is the result, it's quite easy: https://stackoverflow.com/questions/5497399/can-exe-generated-by-cx-freeze-be-completely-decompiled-back-to-readable-python/62415977#62415977 – Basj Jun 20 '20 at 21:54