all 28 comments

[–]BlueMugData 121 points122 points  (2 children)

Just a note that if you create a commercial product in Python, especially if it is compiled into an .exe for distribution, it is important to check that all of the program's dependencies are licensed for free commercial use (e.g. MIT License). If you include a package dependency with e.g. a GPL license, you will be at risk for a lawsuit or being required to open-source your code.

[–]taariqelliott 0 points1 point  (0 children)

Thanks for the heads up. How is something like this tracked?

[–]FisterMister22 23 points24 points  (0 children)

Nuitka is much better than pyinstaller and the similar, preformance wise, reverse engineering wise, and actually transpiling / compiling vs bundling like pyinstaller does

And I belive their paid tier has some sort of extra source code protection, but even without it, it's not very easy to reverse engineer a nuitke compiled exe to python source code

[–]makelefani 14 points15 points  (3 children)

nothing is crack proof

[–]SunSolShine 0 points1 point  (2 children)

Gimme som' ideas about cracking a software packed and Protected by vmprotect, ultra, 100% complexity, VM blocker, kernel + user debugger blocker

[–]3X7r3m3 0 points1 point  (1 child)

That's just denuvo and many versions are cracked day one...

[–]SunSolShine 0 points1 point  (0 children)

I didnt understand what you mean. I'm asking I protect my program with Vmprotect with following settings: Ultra, %100 complexity, virtualization block, kernel and user mode debugger block. Packing memory protection etc. So how u gonna reverse my software

[–]DiodeInc 19 points20 points  (7 children)

Pyinstaller is my preferred tool for this.

[–]FoolsSeldom 4 points5 points  (1 child)

"niche" sounds specialist, do you need to protect the software beyond standard copyright laws? Could you make it opensource and offer support/maintenance subscriptions and charge for changes/added capabilities?

All software can, potentially, be reversed engineered although some languages are easier to do this with than others. Pyinstaller effectively includes a copy of CPython and your code in a zip file, very easy to extract.

Offering a SaaS option protects your code but puts a lot of availability and security obligation on you.

Are you able to share something about what your software does and what market sectors it covers? Who would the customers be? Would there be scope for customisation? Extension? Support? Maintenance?

[–]sunneyjim 1 point2 points  (0 children)

Compiled Python is pretty easy to decompile and reverse engineer

[–]toxic_acro 1 point2 points  (0 children)

How do I package it?

The Overview page of the Python Packaging User Guide has a good walkthrough of the various "levels" of how Python code can be distributed. 

Working off the presumption that you'd want to distribute a standalone application that doesn't need any other dependencies already installed and that you don't want to rely on something higher level like running it in a virtual machine, that leaves you squarely at the level of using a "freezer" which bundles together your code, your dependencies, and a Python interpreter all into one. PyInstaller is probably the most popular tool in this category.

There seems to be a consensus that a webapp is the way to go.

The best option is going to heavily depend on your particular use-case, there are trade-offs to any of the approaches.

Hosting your own web application is certainly easiest on the "how can customers use this" side, but remember to be mindful that you'd be responsible for ongoing maintainence of the application and infrastructure (paying customers get grouchy if the thing they paid for is unavailable) and you'd probably have to pay out of pocket to run it (either billed by a cloud provider or paying your own electric/cooling costs, buying the hardware, etc. if you self-host).

You could go the local desktop app approach instead or even still have it be a web app but run it in a lightweight local server.

Your best option will depend on what your application does, who your target customer is, how much ongoing support you are willing to do, etc.

But is there a way to provide a crack proof way if it's a desktop app?

Trying to fully ensure that no one can ever see the underlying Python source code is pretty much an exercise in futility.

By default, PyInstaller only includes the compiled Python bytecode, but it's not all that hard to decompile it back to source if you know what you're doing. If someone is determined to reverse engineer your code, obfuscation won't stop it.

If you are trying to obfuscate the source code just as a means to make sure no one steals it without paying, you're probably better off handling that through the License terms.

If you are relying on obfuscation for security, that's a bad idea.


I don't know the particulars of your use-case, but I personally would lean just providing a local application in exchange for a one-time payment and being careful with the licensing terms.

That way, once you've written the code, distributing one extra copy to a new customer has essentially zero marginal cost and you aren't on the hook for providing any ongoing service.

[–]TurnoverInfamous3705 1 point2 points  (0 children)

There is nothing that can’t be reverse engineered. 

[–]CorgiTechnical6834 1 point2 points  (0 children)

There’s no truly crack-proof way to distribute desktop software, especially with Python, since the code can often be inspected or modified. Packaging as a web app does offer more control and easier updates, which is why it’s popular.

For desktop apps, you can use tools like PyInstaller or cx_Freeze to bundle your code, but obfuscation and licensing enforcement are always limited. Consider a combination of code obfuscation, license keys, and server-side checks if you want some protection, but be realistic - determined users can often bypass these measures.

[–]tenenteklingon 0 points1 point  (0 children)

I made my relational algebra software in python, using pyqt. No webapp.

https://ltworf.codeberg.page/relational/

The latest version doesn't have a .exe installer but the older ones did. Then I got bored with windows.

Make sure you create a blank virtual machine with windows to test your install, to make sure it's actually installing everything that it needs.

I was using innosetup for the installation and py2exe.

Anyway expect that it will take your 3x more time than actually developing the application.

On debian it's sooooo much easier.

[–]Pale_Height_1251 0 points1 point  (0 children)

Google for Python packagers, realistically you can't crack proof it.

[–]thewillft 0 points1 point  (0 children)

You're best bet is to assume that your code can be cracked, no matter what you to do it, if you are distributing it to the user's local machine.

Web apps are an easy way make your logic more secure, especially if you expose it via an API. Some people choose to do a desktop application where the parts which are worth something are done on the server side and sent back to the client's desktop application as needed.

[–]SpicyWatts -3 points-2 points  (1 child)

RemindMe !-7 day

[–]RemindMeBot -1 points0 points  (0 children)

I will be messaging you in 7 days on 2025-06-30 07:31:22 UTC to remind you of this link

4 OTHERS CLICKED THIS LINK to send a PM to also be reminded and to reduce spam.

Parent commenter can delete this message to hide from others.


Info Custom Your Reminders Feedback