Python Forum
Make my py script work only on 1 compter - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: General Coding Help (https://python-forum.io/forum-8.html)
+--- Thread: Make my py script work only on 1 compter (/thread-36412.html)

Pages: 1 2


Make my py script work only on 1 compter - tomtom - Feb-17-2022

I want my py program to work only on one specific computer.
My aim is to get a unique ID of any computer of any OS once my program is first lauch on that computer, then i will save the ID into a database for later confirmation if the program is runing on the same computer or not.

I used this;
import uuid
Computer_id = uuid.getnode()
print(Computer_id)
I dont really know how this getnode() method works, I saw it on stackover answer. But the problem is that it keep returning different id number on a period of time which is not what I want!

Please how can I get any unque id of a computer like motherboard ID, serial number or any unique id using python?


RE: Make my py script work only on 1 compter - ndc85430 - Feb-17-2022

Explaining why you want to do that in the first place would be a good start.


RE: Make my py script work only on 1 compter - tomtom - Feb-17-2022

(Feb-17-2022, 01:09 PM)ndc85430 Wrote: Explaining why you want to do that in the first place would be a good start.

I want to put a license on the program so that users can get a license that work on 1,2,3... computers base on their need


RE: Make my py script work only on 1 compter - jefsummers - Feb-17-2022

I think you are on the right path, but some kinks. What version of Python?
UUID.getnode() gets the MAC address of the computer, which should be unique. However, computers may have more than one interface, and therefore more than one MAC address (wired vs wifi connections, for example).

I suggest reading the documentation on uuid at https://docs.python.org/3/library/uuid.html


RE: Make my py script work only on 1 compter - tomtom - Feb-17-2022

(Feb-17-2022, 01:46 PM)jefsummers Wrote: I think you are on the right path, but some kinks. What version of Python?
UUID.getnode() gets the MAC address of the computer, which should be unique. However, computers may have more than one interface, and therefore more than one MAC address (wired vs wifi connections, for example).

I suggest reading the documentation on uuid at https://docs.python.org/3/library/uuid.html
Okay, Thank you i will read
python 3.8.3 is my python version
But since it is for mac adress does it work on other OS as well?


RE: Make my py script work only on 1 compter - buran - Feb-17-2022

IMHO, if user is determined enough and your program worths the efforts (given the price you want per license) they will always find a way to hack your defence. Consider offering it as SAAS if feasible. Otherwise the license/legal protection is the best approach to protect your work if it's worth the legal troubles. Also, try to find other ways to monetise your app - e.g. offering extra services that represent added value.


RE: Make my py script work only on 1 compter - tomtom - Feb-17-2022

(Feb-17-2022, 02:38 PM)buran Wrote: IMHO, if user is determined enough and your program worths the efforts (given the price you want per license) they will always find a way to hack your defence. Consider offering it as SAAS if feasible. Otherwise the license/legal protection is the best approach to protect your work if it's worth the legal troubles. Also, try to find other ways to monetise your app - e.g. offering extra services that represent added value.

i'm going to compile the script, example to .exe
Also it does'nt matter if crack, I just still want to add the lincense


RE: Make my py script work only on 1 compter - bowlofred - Feb-17-2022

(Feb-17-2022, 10:07 PM)tomtom Wrote: i'm going to compile the script, example to .exe

Imagine your code is running in a virtual machine. It doesn't let programs running know anything about the physical host it's on, just the virtual host. It can pretend to have any particular hardware attached. The information about motherboard or attached peripherals can be duplicated or made up. Unless you're doing something with cryptographic secrets (like a dongle), the VM or the OS can lie about anything you ask.

Most VM software can generate a unique ID for admins that are cooperating to keep them separate. But if the owner wants to duplicate them and make the hosts indistinguishable, that can be done.


RE: Make my py script work only on 1 compter - buran - Feb-18-2022

(Feb-17-2022, 10:07 PM)tomtom Wrote: i'm going to compile the script, example to .exe
https://reverseengineering.stackexchange.com/q/160
Just an example. This is really not an obstacle.

(Feb-17-2022, 10:07 PM)tomtom Wrote: I just still want to add the lincense
Actually, that is what I said - add license and then legal steps to enforce the license if worth it. Always include license.


Anyway, have a look a pyarmor if you are determined to do what you say.


RE: Make my py script work only on 1 compter - ndc85430 - Feb-18-2022

The other question is: is it really worth it? What's the risk if you don't prevent people doing that?