How to add license for my python application?

Asked

Viewed 822 times

-1

I’m having a problem. This problem is "How to create a license for my software".

Suppose this is my license key - 12345YW

When the user enters this license key, the software should allow him to use the software. All right, after the user enters the license key, my software should remember that he entered the valid key, right? (Because next time on, he won’t need to open the license dialog) My question is: How can I develop this? It is possible to do?

Again I ask that those who are negatively questioning my questions leave in the comments what they want to change. Just negative won’t make me understand what you didn’t like.

1 answer

5

A 100% guaranteed way to do this does not exist. However, you can create the thing so that without doing a reverse engineering of your code the person has no way to use - and if you do, you will know that you are violating the software assignment agreement and subject to be triggered in court.

The quieter, if you are going to opt for this business model, would be to keep the "core" of your software, the part that provides the same value, in the cloud - and then, if the user is behind the license, you block the login and solved. Payment data, etc...stays on your servers and has no headache. This does not require the software to be web - you can develop a Python interface as well, using Qt or another library of your choice, and only delegate the processing of critical functions (and possibly data storage) to your servers. But you can also create a 100% web interface and keep all the software on your side.

That said, the first thing: if your client has the files. py doseu program, which is the preferred way to make complex software available in Python (even if in parallel there is a binary "standalone" distribution), it is trivial to find the path blocked by the lack of the license and change the system to not need it. So you have to create a standalone distribution, one suggestion is to use the pyinstaller, or even the nuitka (the first packages the Python executable and all the modules you use in a "zip" that is transformed into an executable, the second actually compiles your Python code for native code and integrates the interpreter - in theory it is easier to 'decompile' the first - but perhaps there are cryptographic options that make this process a little more difficult).

After that, keeping the license already typed once is something trivial: use a file in a known location. Since the password is known to your user, it is a problem that it is in "plaintext" in this file - but you can make it up with a cryptographic function. You can also use operating system functions, to create an entry in the "Registry" in the case of Windows and leave the value there.

When starting the program, it is trivial: you first try to read the license of that external storage point - if it does not exist, or is invalid, you present the dialog asking for it, as described.

Perhaps a viable way to maintain access control in software that is local to the client is to separate critical code from its application into a module or package, and even in the standalone distribution, to store the source code of that part of the code as an encrypted string. The password to decrypt this string may be the use license itself, or preferably a derivative of the program’s use license and user name (hence if it copies the program to a third party, any reports, etc...will come out with the name of the first licensee) - and at the time of execution, after obtaining the license as described above, you decrypt that part of the code and use the function compile Python - only then will this part of the program be available for use. It is not yet 100% safe - the user can find a way to open a debug prompt in his program, and save the protected bytecode in an external file, etc.. but it’s getting more complicated.

To give you an idea, Dropbox, the company that employed Guido van Rossum himself in recent years (he recently announced his retirement), is one of the software distributions made in Python for local use, and that is well protected against reverse engineering - and they themselves took some time, and several people working on the problem, before arriving at a solution to this.

So I started by saying that cloud operation can be simpler.

  • I used pyinstaller and it worked right

  • It does not need to be 100% secure. The application does not involve banking transactions or anything like that. It is a simple screen recorder.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.