def read_handy_store(page):
    cdb = [0xD8, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x01, 0x00]
    i = 2
    for c in htonl(page):
        cdb[i] = c
        i += 1
    data = py_sg.read_as_bin_str(dev, _scsi_pack_cdb(cdb), BLOCK_SIZE)
    return data
Esempio n. 2
0
def get_encryption_status():
    cdb = [0xC0, 0x45, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x00]
    data = py_sg.read_as_bin_str(dev, _scsi_pack_cdb(cdb), BLOCK_SIZE)
    if data[0] != 0x45:
        print(fail("Wrong encryption status signature %s" % hex(data[0])))
        sys.exit(1)
    ##  SecurityStatus, CurrentChiperID, KeyResetEnabler
    return (data[3], data[4], data[8:12])
def get_encryption_status():
    cdb = [0xC0, 0x45, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x00]
    data = py_sg.read_as_bin_str(dev, _scsi_pack_cdb(cdb), BLOCK_SIZE)
    if data[0] != 0x45:
        print(fail("Wrong encryption status signature: %s." % hex(data[0])))
        sys.exit(1)
    return {
        "Locked": data[3],
        "Cipher": data[4],
        "PasswordLength": struct.unpack('!H', data[6:8])[0],
        "KeyResetEnabler": data[8:12],
    }