edsheeran edsheeran - 3 months ago 13
Python Question

Implementing HWID checking system for Python scripts?

Let's say I was selling a software and I didn't want it to be leaked (of course using Python wouldn't be the greatest as all code is open but let's just go with it), I would want to get a unique ID that only the user's PC has and store it within a list in my script. Now every time someone executed the script it would iterate through the list and check to see if that unique ID matches with one from the list.

Would this even be possible and if so how would one implement it in Python?

Answer

Python has a unique id library uuid. https://docs.python.org/3.5/library/uuid.html

import uuid
# Create a uuid
customer_id = str(uuid.uuid4())
software_ids = [customer_id] # Store in a safe secure place

can_run = customer_id in software_ids
print(can_run)