import binascii import filetimes from kmsPidGenFromDB import epidGenerator, kmsdb import os import os.path import sys import time try: import uuid except ImportError: import upy.uuid as uuid try: import codecs except ImportError: import upy.codecs as codecs from structure import Structure # sqlite3 is optional try: import sqlite3 except ImportError: pass from xmltok import tokenize from uxml2dict import parse licenseStates = { 0 : "Unlicensed", 1 : "Activated", 2 : "Grace Period", 3 : "Out-of-Tolerance Grace Period", 4 : "Non-Genuine Grace Period", 5 : "Notifications Mode", 6 : "Extended Grace Period", } licenseStatesEnum = { 'unlicensed': 0, 'licensed': 1, 'oobGrace': 2, 'ootGrace': 3, 'nonGenuineGrace': 4, 'notification': 5, 'extendedGrace': 6 } errorCodes = { 'SL_E_VL_NOT_WINDOWS_SLP' : 0xC004F035, 'SL_E_VL_NOT_ENOUGH_COUNT' : 0xC004F038, 'SL_E_VL_BINDING_SERVICE_NOT_ENABLED' : 0xC004F039, 'SL_E_VL_INFO_PRODUCT_USER_RIGHT' : 0x4004F040, 'SL_I_VL_OOB_NO_BINDING_SERVER_REGISTRATION' : 0x4004F041, 'SL_E_VL_KEY_MANAGEMENT_SERVICE_ID_MISMATCH' : 0xC004F042, 'SL_E_VL_MACHINE_NOT_BOUND' : 0xC004F056 } class UUID(Structure): commonHdr = () structure = ( ('raw', '16s'), ) def get(self): return uuid.UUID(bytes_le=self.__bytes__()) class kmsRequestStruct(Structure): commonHdr = () structure = ( ('versionMinor', '