Exemplo n.º 1
0
def authorization_id_decode(message):
    #cmd_id = 0x0007
    auth_id = message[34:38]
    auth_id = utils.u32_unpack(auth_id)
    uuid    = message[38:54]
    nonce_k = message[54:86]
    return auth_id, uuid, nonce_k
Exemplo n.º 2
0
def config_decode(message):
    #cmd_id     = 0x0015
    id = message[2:6]
    name = message[6:38]
    id = utils.u32_unpack(id)
    name = utils.string_unpack(name)
    return id, name
Exemplo n.º 3
0
def decrypt_rx(adata, key):
    nonce = adata[:24]
    message = adata[30:]
    decrypted = decrypt(message, nonce, key)
    len_msg = len(decrypted)
    message = decrypted[:len_msg - 2]
    msg_crc = decrypted[len_msg - 2:len_msg]
    msg_crc = utils.u16_unpack(msg_crc)
    crc_val = utils.get_crc(message)
    auth_id = message[0:4]
    auth_id = utils.u32_unpack(auth_id)
    message = message[4:]

    if (msg_crc != crc_val):
        print "crc error: " + str(hex(crc_val))

    utils.verify_crc(decrypted)

    return auth_id, message, decrypted
Exemplo n.º 4
0
def get_auth_id(message):
    auth_id = message[24:28]
    return utils.u32_unpack(auth_id)