How to protect your Python code

Asked 2 years ago, Updated 2 years ago, 131 views

I am developing software that will be distributed to customers with Python now. The boss wants to restrict the use of the software by placing a part-time license.

The problem is that if you distribute a .py or .pyc file (decompile) you can erase the code that verifies the license.

The boss also hopes that the code will not be released to the customer because he is worried that he can copy the code if the customer can read it.

How can I solve this problem? If possible, it would be good if it was a standardized solution.

By the way, the software will work on a Linux system basis (so py2exe won't be the solution).)

licensing obfuscation python copy-protection

2022-09-22 21:41

1 Answers

Protecting Python's code, an interpreting language compiled with byte code, is quite challenging. Even with exe packaging tools such as py2exe, the structure of the executable is quite well known, and Python's byte code is legible.

In this case, some compromise is required. We need to consider how much the code is worth protecting, whether there's really something to hide (such as the key value of encryption that's going to be used for banking transactions) or whether we're just trying to overprotect it. You need to choose a language that will help you develop the best products as soon as possible, and look realistically at how valuable your ideas are.

If you really think license verification needs to be done safely, you can make reverse engineering very difficult by leaving the basic code in Python and writing only the code for license verification in a small C extension. (Of course, it's not impossible!))


2022-09-22 21:41

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.