-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlicensa.py
More file actions
23 lines (20 loc) · 853 Bytes
/
licensa.py
File metadata and controls
23 lines (20 loc) · 853 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
from licensing.models import *
from licensing.methods import Key, Helpers
RSAPubKey = "xxx"## defina aqui sua chave rsa
auth = "xxx" ## defina aqui sua authkey
prod_id = 'xxx'#defina aqui seu id de produto da cryptolens
def Authkey(key):
result = Key.activate(token=auth,\
rsa_pub_key=RSAPubKey,\
product_id=prod_id,\
key=key,\
machine_code=Helpers.GetMachineCode())
if result[0] == None or not Helpers.IsOnRightMachine(result[0]):
print("Licença invalida: {0}".format(result[1]))
return False, None
else:
print("Licenciamento validado atraves da api.")
license_key = result[0]
expiration_date_formatted = license_key.expires.strftime('%d-%m-%Y %H:%M:%S')
print("Licença expira: " + str(expiration_date_formatted))
return True, license_key.expires