1
0
mirror of https://github.com/ThunderEX/py-kms.git synced 2025-04-18 07:44:00 +03:00

fix bug reported by Raydan that KmsDataBase.xml unavailable in kmsPidGenFromDB.py

This commit is contained in:
ThunderEX 2018-11-19 11:43:01 +08:00
parent d014085663
commit 87384a0e64
No known key found for this signature in database
GPG Key ID: CF5EAA08897EE137
2 changed files with 4 additions and 4 deletions

View File

@ -1,6 +1,6 @@
import binascii
import filetimes
from kmsPidGenFromDB import epidGenerator
from kmsPidGenFromDB import epidGenerator, kmsdb
import os
import os.path
import sys
@ -25,8 +25,6 @@ except ImportError:
from xmltok import tokenize
from uxml2dict import parse
kmsdb = os.path.join(os.path.dirname(__file__), 'KmsDataBase.xml')
licenseStates = {
0 : "Unlicensed",
1 : "Activated",

View File

@ -1,3 +1,4 @@
import os.path
try:
import random
except ImportError:
@ -10,6 +11,7 @@ except ImportError:
from xmltok import tokenize
from uxml2dict import parse
kmsdb = os.path.join(os.path.dirname(__file__), 'KmsDataBase.xml')
platform_id = 3612
@ -24,7 +26,7 @@ os_build = '17763.0000'
def epidGenerator(kmsId, version, lcid):
# Generate Part 2: Group ID and Product Key ID Range
xml = parse(tokenize(open('KmsDataBase.xml')), lesslist=False)
xml = parse(tokenize(open(kmsdb)), lesslist=False)
for item in xml['KmsData'][0]['CsvlkItems'][0]['CsvlkItem']:
if '@VlmcsdIndex' in item and kmsId in [uuid.UUID(kms_item['@KmsItem']) for kms_item in item['Activate']]:
group_id, key_id_min, key_id_max = int(item['@GroupId']), int(item['@MinKeyId']), int(item['@MaxKeyId'])