def __init__(self, data): self.data = data self.type_guid = uuid.UUID(bytes_le=data[self.TYPE_GUID_START : self.TYPE_GUID_END]) self.unique_guid = uuid.UUID(bytes_le=data[self.UNIQUE_GUID_START : self.UNIQUE_GUID_END]) self.first_lba = to_int(data[self.FIRST_LBA_START : self.FIRST_LBA_END]) self.last_lba = to_int(data[self.LAST_LBA_START : self.LAST_LBA_END]) self.attribute_flags = data[self.ATTRIBUTE_FLAGS_START : self.ATTRIBUTE_FLAGS_END] self.name = data[self.NAME_START : self.NAME_END].decode("utf_16_le")
def __init__(self, data): self.data = data self.signature = data[Gpt.SIGNATURE_START : Gpt.SIGNATURE_END] self.revision = data[Gpt.REVISION_START : Gpt.REVISION_END] self.header_size = to_int(data[Gpt.HEADER_SIZE_START : Gpt.HEADER_SIZE_END]) self.header_crc = data[Gpt.HEADER_CRC_START : Gpt.HEADER_CRC_END] self.current_lba = to_int(data[Gpt.CURRENT_LBA_START : Gpt.CURRENT_LBA_END]) self.backup_lba = to_int(data[Gpt.BACKUP_LBA_START : Gpt.BACKUP_LBA_END]) self.first_lba = to_int(data[Gpt.FIRST_LBA_START : Gpt.FIRST_LBA_END]) self.last_lba = to_int(data[Gpt.LAST_LBA_START : Gpt.LAST_LBA_END]) self.guid = uuid.UUID(bytes_le=data[Gpt.GUID_START : Gpt.GUID_END]) self.start_lba = to_int(data[Gpt.STARTING_LBA_START : Gpt.STARTING_LBA_END]) self.nr_entries = to_int(data[Gpt.NUMBER_ENTRIES_START : Gpt.NUMBER_ENTRIES_END]) self.entry_size = to_int(data[Gpt.ENTRY_SIZE_START : Gpt.ENTRY_SIZE_END]) self.partitions_crc = data[Gpt.PARTITIONS_CRC_START : Gpt.PARTITIONS_CRC_END]