Skip to content

Commit 253dcac

Browse files
committed
Use similar approach to generate machine code as in .NET
1 parent cfcaf82 commit 253dcac

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed

licensing/internal.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
from Crypto.PublicKey import RSA
1111
import urllib.request
1212
import hashlib
13+
from subprocess import Popen, PIPE
1314

1415
class HelperMethods:
1516

@@ -49,4 +50,12 @@ def send_request(method, params):
4950
return urllib.request.urlopen(HelperMethods.server_address + method, \
5051
urllib.parse.urlencode(params)\
5152
.encode("utf-8")).read().decode("utf-8")
53+
54+
55+
def start_process(command):
56+
57+
process = Popen(command, stdout=PIPE)
58+
(output, err) = process.communicate()
59+
exit_code = process.wait()
60+
return output.decode("utf-8")
5261

licensing/methods.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,9 @@ def GetMachineCode():
6767
Get a unique identifier for this device.
6868
"""
6969

70+
"""
7071
res = []
72+
7173
res.append(platform.machine())
7274
res.append(platform.machine())
7375
res.append(platform.processor())
@@ -77,8 +79,14 @@ def GetMachineCode():
7779
# safer than using architecture()[0]
7880
# see https://docs.python.org/3/library/platform.html#platform.architecture
7981
res.append(str(sys.maxsize > 2**32))
82+
"""
83+
84+
if "Windows" in platform.platform():
85+
return HelperMethods.get_SHA256(HelperMethods.start_process(["cmd.exe", "/C", "wmic","csproduct", "get", "uuid"]))
86+
else:
87+
return "";
8088

81-
return HelperMethods.get_SHA256(":".join(res))
89+
#return HelperMethods.get_SHA256(":".join(res))
8290

8391
def IsOnRightMachine(license_key, is_floating_license = False, allow_overdraft=False):
8492

0 commit comments

Comments
 (0)