示例#1
0
def createKmsRequest():
        # Update the call ID
        config['call_id'] += 1

        # KMS Protocol Major Version
        if config['KMSProtocolMajorVersion'] == 4:
                handler = kmsRequestV4(None, config)
        elif config['KMSProtocolMajorVersion'] == 5:
                handler = kmsRequestV5(None, config)
        elif config['KMSProtocolMajorVersion'] == 6:
                handler = kmsRequestV6(None, config)
        else:
                return None

        requestBase = createKmsRequestBase()
        return handler.generateRequest(requestBase)
示例#2
0
def createKmsRequest():
    # Update the call ID
    config['call_id'] += 1

    # KMS Protocol Major Version
    if config['KMSProtocolMajorVersion'] == 4:
        handler = kmsRequestV4(None, config)
    elif config['KMSProtocolMajorVersion'] == 5:
        handler = kmsRequestV5(None, config)
    elif config['KMSProtocolMajorVersion'] == 6:
        handler = kmsRequestV6(None, config)
    else:
        return None

    requestBase = createKmsRequestBase()
    return handler.generateRequest(requestBase)
示例#3
0
def generateKmsResponseData(data, config):
	version = GenericRequestHeader(data)['versionMajor']
	currentDate = time.strftime("%a %b %d %H:%M:%S %Y")

	if version == 4:
		print("Received V%d request on %s." % (version, currentDate))
		messagehandler = kmsRequestV4.kmsRequestV4(data, config)
	elif version == 5:
		print("Received V%d request on %s." % (version, currentDate))
		messagehandler = kmsRequestV5.kmsRequestV5(data, config)
	elif version == 6:
		print("Received V%d request on %s." % (version, currentDate))
		messagehandler = kmsRequestV6.kmsRequestV6(data, config)
	else:
		print("Unhandled KMS version.", version)
		messagehandler = kmsRequestUnknown.kmsRequestUnknown(data, config)
	return messagehandler.executeRequestLogic()
示例#4
0
文件: kmsBase.py 项目: mengzxh/py-kms
def generateKmsResponseData(data, config):
	version = GenericRequestHeader(data)['versionMajor']
	currentDate = time.strftime("%a %b %d %H:%M:%S %Y")

	if version == 4:
		print("Received V%d request on %s." % (version, currentDate))
		messagehandler = kmsRequestV4.kmsRequestV4(data, config)
	elif version == 5:
		print("Received V%d request on %s." % (version, currentDate))
		messagehandler = kmsRequestV5.kmsRequestV5(data, config)
	elif version == 6:
		print("Received V%d request on %s." % (version, currentDate))
		messagehandler = kmsRequestV6.kmsRequestV6(data, config)
	else:
		print("Unhandled KMS version.", version)
		messagehandler = kmsRequestUnknown.kmsRequestUnknown(data, config)
	return messagehandler.executeRequestLogic()
示例#5
0
def generateKmsResponseData(data, config):
    version = kmsBase.GenericRequestHeader(data)["versionMajor"]
    currentDate = datetime.datetime.now().ctime()

    if version == 4:
        print "Received V%d request on %s." % (version, currentDate)
        messagehandler = kmsRequestV4.kmsRequestV4(data, config)
        messagehandler.executeRequestLogic()
    elif version == 5:
        print "Received V%d request on %s." % (version, currentDate)
        messagehandler = kmsRequestV5.kmsRequestV5(data, config)
        messagehandler.executeRequestLogic()
    elif version == 6:
        print "Received V%d request on %s." % (version, currentDate)
        messagehandler = kmsRequestV6.kmsRequestV6(data, config)
        messagehandler.executeRequestLogic()
    else:
        print "Unhandled KMS version.", version
        messagehandler = kmsRequestUnknown.kmsRequestUnknown(data, config)
    return messagehandler.getResponse()
示例#6
0
def generateKmsResponseData(data, config):
    version = kmsBase.GenericRequestHeader(data)['versionMajor']
    currentDate = datetime.datetime.now().ctime()

    if version == 4:
        print "Received V%d request on %s." % (version, currentDate)
        messagehandler = kmsRequestV4.kmsRequestV4(data, config)
        messagehandler.executeRequestLogic()
    elif version == 5:
        print "Received V%d request on %s." % (version, currentDate)
        messagehandler = kmsRequestV5.kmsRequestV5(data, config)
        messagehandler.executeRequestLogic()
    elif version == 6:
        print "Received V%d request on %s." % (version, currentDate)
        messagehandler = kmsRequestV6.kmsRequestV6(data, config)
        messagehandler.executeRequestLogic()
    else:
        print "Unhandled KMS version.", version
        messagehandler = kmsRequestUnknown.kmsRequestUnknown(data, config)
    return messagehandler.getResponse()
示例#7
0
def readKmsResponseV6(data):
    response = kmsRequestV6.ResponseV5(data)
    decrypted = kmsRequestV6(data, config).decryptResponse(response)
    message = decrypted['message']
    return message
示例#8
0
def readKmsResponseV6(data):
        response = kmsRequestV6.ResponseV5(data)
        decrypted = kmsRequestV6(data, config).decryptResponse(response)
        message = decrypted['message']
        return message