C
C
CleanyBoom2021-12-29 19:18:01
Python
CleanyBoom, 2021-12-29 19:18:01

Python software protection?

Is it possible to somehow implement authorization only for specific devices in a Python application?

Answer the question

In order to leave comments, you need to log in

4 answer(s)
V
Vindicar, 2021-12-29
@Vindicar

The question is generally "how to identify a computer". And it's not trivial.
1. Get the MAC address of the network card and check if it is in the list. The easiest way to get it is something like this:

import uuid
print(hex(uuid.getnode()))

* it is not clear how the function will behave if there are several network adapters on the computer.
* changing the network card will break the program
* The MAC address of the network card can often be changed
2. You can try using the CPUID, for example, like this .
But I have no idea which processors support it!
3. You can place a secret value in the registry of target machines and check for its presence.
The biggest problem is that this check can be broken by anyone more or less familiar with the .
You can use a package like pyarmor, it kind of provides a mechanism for creating "licenses" and obfuscates the source code to make it harder to parse and modify. But pyarmor also breaks off if desired.
So the main question is: what for?

B
Bla Bla, 2021-12-29
@SubUser

pyarmor + checking by hwid
hwid example:

def check_hardware_hwid():
    hwid = str(str(subprocess.check_output('wmic csproduct get uuid')).strip().replace(r"\r", "").split(r"\n")[1].strip())
    r = requests.get("https://pastebin.com/raw/fC1Tqs18")
    if hwid in r.text:
        print("Access granted...")
    else:
        print("Error! HWID Not I Database!")
        print("Please contact @mwsde in Telegram. HWID: " + hwid)
        os.system('pause >NUL')

M
mihavxc, 2021-12-30
@mihavxc

If you really need protection, not creating its visibility, then here is the solution, but it is rather heavy https://thales-sentinel.ru/protection/python/
But first it would be better to decide on the threat model.

S
Skillz01, 2022-01-06
@Skillz01

I read somewhere that Google Chrome will recognize the serial number of the processor. Helps to "recognize" the computer on which it works. I don't know exactly how it works in Python. But I think if you look, you can find info. And at the expense of the MAC address, if there are several network cards, then this parameter will not be so unique.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question