def _read(self): self._debug['catalog_end']['start'] = self._io.pos() self.catalog_end = self._io.read_bytes(1) self._debug['catalog_end']['end'] = self._io.pos() if not self.catalog_end == b"\x00": raise kaitaistruct.ValidationNotEqualError( b"\x00", self.catalog_end, self._io, u"/types/volume_info/seq/0") self._debug['unused']['start'] = self._io.pos() self.unused = self._io.read_bytes(224) self._debug['unused']['end'] = self._io.pos() self._debug['first_free_sector_sector']['start'] = self._io.pos() self.first_free_sector_sector = self._io.read_u1() self._debug['first_free_sector_sector']['end'] = self._io.pos() self._debug['first_free_sector_track']['start'] = self._io.pos() self.first_free_sector_track = self._io.read_u1() self._debug['first_free_sector_track']['end'] = self._io.pos() self._debug['disk_type']['start'] = self._io.pos() self.disk_type = KaitaiStream.resolve_enum(self._root.DiskType, self._io.read_u1()) self._debug['disk_type']['end'] = self._io.pos() self._debug['num_files']['start'] = self._io.pos() self.num_files = self._io.read_u1() self._debug['num_files']['end'] = self._io.pos() self._debug['num_free_sectors']['start'] = self._io.pos() self.num_free_sectors = self._io.read_u2le() self._debug['num_free_sectors']['end'] = self._io.pos() self._debug['tr_dos_id']['start'] = self._io.pos() self.tr_dos_id = self._io.read_bytes(1) self._debug['tr_dos_id']['end'] = self._io.pos() if not self.tr_dos_id == b"\x10": raise kaitaistruct.ValidationNotEqualError( b"\x10", self.tr_dos_id, self._io, u"/types/volume_info/seq/7") self._debug['unused_2']['start'] = self._io.pos() self.unused_2 = self._io.read_bytes(2) self._debug['unused_2']['end'] = self._io.pos() self._debug['password']['start'] = self._io.pos() self.password = self._io.read_bytes(9) self._debug['password']['end'] = self._io.pos() self._debug['unused_3']['start'] = self._io.pos() self.unused_3 = self._io.read_bytes(1) self._debug['unused_3']['end'] = self._io.pos() self._debug['num_deleted_files']['start'] = self._io.pos() self.num_deleted_files = self._io.read_u1() self._debug['num_deleted_files']['end'] = self._io.pos() self._debug['label']['start'] = self._io.pos() self.label = self._io.read_bytes(8) self._debug['label']['end'] = self._io.pos() self._debug['unused_4']['start'] = self._io.pos() self.unused_4 = self._io.read_bytes(3) self._debug['unused_4']['end'] = self._io.pos()
def _read(self): self.id = self._io.read_bytes(4) if not self.id == b"\x53\x44\x4E\x41": raise kaitaistruct.ValidationNotEqualError( b"\x53\x44\x4E\x41", self.id, self._io, u"/types/dna1_body/seq/0") self.name_magic = self._io.read_bytes(4) if not self.name_magic == b"\x4E\x41\x4D\x45": raise kaitaistruct.ValidationNotEqualError( b"\x4E\x41\x4D\x45", self.name_magic, self._io, u"/types/dna1_body/seq/1") self.num_names = self._io.read_u4le() self.names = [] for i in range(self.num_names): self.names.append( (self._io.read_bytes_term(0, False, True, True)).decode(u"UTF-8")) self.padding_1 = self._io.read_bytes(((4 - self._io.pos()) % 4)) self.type_magic = self._io.read_bytes(4) if not self.type_magic == b"\x54\x59\x50\x45": raise kaitaistruct.ValidationNotEqualError( b"\x54\x59\x50\x45", self.type_magic, self._io, u"/types/dna1_body/seq/5") self.num_types = self._io.read_u4le() self.types = [] for i in range(self.num_types): self.types.append( (self._io.read_bytes_term(0, False, True, True)).decode(u"UTF-8")) self.padding_2 = self._io.read_bytes(((4 - self._io.pos()) % 4)) self.tlen_magic = self._io.read_bytes(4) if not self.tlen_magic == b"\x54\x4C\x45\x4E": raise kaitaistruct.ValidationNotEqualError( b"\x54\x4C\x45\x4E", self.tlen_magic, self._io, u"/types/dna1_body/seq/9") self.lengths = [] for i in range(self.num_types): self.lengths.append(self._io.read_u2le()) self.padding_3 = self._io.read_bytes(((4 - self._io.pos()) % 4)) self.strc_magic = self._io.read_bytes(4) if not self.strc_magic == b"\x53\x54\x52\x43": raise kaitaistruct.ValidationNotEqualError( b"\x53\x54\x52\x43", self.strc_magic, self._io, u"/types/dna1_body/seq/12") self.num_structs = self._io.read_u4le() self.structs = [] for i in range(self.num_structs): self.structs.append( BlenderBlend.DnaStruct(self._io, self, self._root))
def _read(self): self.colon = self._io.read_bytes(1) if not self.colon == b"\x3A": raise kaitaistruct.ValidationNotEqualError( b"\x3A", self.colon, self._io, u"/types/string_contents/seq/0") self.string = PhpSerializedValue.LengthPrefixedQuotedString( self._io, self, self._root) self.semicolon = self._io.read_bytes(1) if not self.semicolon == b"\x3B": raise kaitaistruct.ValidationNotEqualError( b"\x3B", self.semicolon, self._io, u"/types/string_contents/seq/2")
def _read(self): self.colon = self._io.read_bytes(1) if not self.colon == b"\x3A": raise kaitaistruct.ValidationNotEqualError( b"\x3A", self.colon, self._io, u"/types/bool_contents/seq/0") self.value_dec = KaitaiStream.resolve_enum( PhpSerializedValue.BoolValue, self._io.read_u1()) self.semicolon = self._io.read_bytes(1) if not self.semicolon == b"\x3B": raise kaitaistruct.ValidationNotEqualError( b"\x3B", self.semicolon, self._io, u"/types/bool_contents/seq/2")
def _read(self): self.magic1 = self._io.read_bytes(6) if not self.magic1 == b"\x52\x61\x72\x21\x1A\x07": raise kaitaistruct.ValidationNotEqualError( b"\x52\x61\x72\x21\x1A\x07", self.magic1, self._io, u"/types/magic_signature/seq/0") self.version = self._io.read_u1() if self.version == 1: self.magic3 = self._io.read_bytes(1) if not self.magic3 == b"\x00": raise kaitaistruct.ValidationNotEqualError( b"\x00", self.magic3, self._io, u"/types/magic_signature/seq/2")
def _read(self): self.magic1 = self._io.read_bytes(1) if not self.magic1 == b"\x08": raise kaitaistruct.ValidationNotEqualError( b"\x08", self.magic1, self._io, u"/types/int_double_pair/seq/0") self.int = self._io.read_s4le() self.magic2 = self._io.read_bytes(1) if not self.magic2 == b"\x0D": raise kaitaistruct.ValidationNotEqualError( b"\x0D", self.magic2, self._io, u"/types/int_double_pair/seq/2") self.double = self._io.read_f8le()
def _read(self): self.file_profile_name = self._io.read_bytes(4) if not self.file_profile_name == b"\x4E\x49\x54\x46": raise kaitaistruct.ValidationNotEqualError(b"\x4E\x49\x54\x46", self.file_profile_name, self._io, u"/types/header/seq/0") self.file_version = self._io.read_bytes(5) if not self.file_version == b"\x30\x32\x2E\x31\x30": raise kaitaistruct.ValidationNotEqualError(b"\x30\x32\x2E\x31\x30", self.file_version, self._io, u"/types/header/seq/1") self.complexity_level = self._io.read_bytes(2) self.standard_type = self._io.read_bytes(4) if not self.standard_type == b"\x42\x46\x30\x31": raise kaitaistruct.ValidationNotEqualError(b"\x42\x46\x30\x31", self.standard_type, self._io, u"/types/header/seq/3") self.originating_station_id = (self._io.read_bytes(10)).decode(u"UTF-8") self.file_date_time = Nitf.DateTime(self._io, self, self._root) self.file_title = (self._io.read_bytes(80)).decode(u"UTF-8") self.file_security = Nitf.Clasnfo(self._io, self, self._root) self.file_copy_number = (self._io.read_bytes(5)).decode(u"UTF-8") self.file_num_of_copys = (self._io.read_bytes(5)).decode(u"UTF-8") self.encryption = Nitf.Encrypt(self._io, self, self._root) self.file_bg_color = self._io.read_bytes(3) self.originator_name = (self._io.read_bytes(24)).decode(u"UTF-8") self.originator_phone = (self._io.read_bytes(18)).decode(u"UTF-8") self.file_length = (self._io.read_bytes(12)).decode(u"UTF-8") self.file_header_length = (self._io.read_bytes(6)).decode(u"UTF-8") self.num_image_segments = (self._io.read_bytes(3)).decode(u"UTF-8") self.linfo = [] for i in range(int(self.num_image_segments)): self.linfo.append(Nitf.LengthImageInfo(self._io, self, self._root)) self.num_graphics_segments = (self._io.read_bytes(3)).decode(u"UTF-8") self.lnnfo = [] for i in range(int(self.num_graphics_segments)): self.lnnfo.append(Nitf.LengthGraphicInfo(self._io, self, self._root)) self.reserved_numx = (self._io.read_bytes(3)).decode(u"UTF-8") self.num_text_files = (self._io.read_bytes(3)).decode(u"UTF-8") self.ltnfo = [] for i in range(int(self.num_text_files)): self.ltnfo.append(Nitf.LengthTextInfo(self._io, self, self._root)) self.num_data_extension = (self._io.read_bytes(3)).decode(u"UTF-8") self.ldnfo = [] for i in range(int(self.num_data_extension)): self.ldnfo.append(Nitf.LengthDataInfo(self._io, self, self._root)) self.num_reserved_extension = (self._io.read_bytes(3)).decode(u"UTF-8") self.lrnfo = [] for i in range(int(self.num_reserved_extension)): self.lrnfo.append(Nitf.LengthReservedInfo(self._io, self, self._root)) self.user_defined_header = Nitf.TreHeader(self._io, self, self._root) self.extended_header = Nitf.TreHeader(self._io, self, self._root)
def _read(self): self._debug['magic1']['start'] = self._io.pos() self.magic1 = self._io.read_bytes(4) self._debug['magic1']['end'] = self._io.pos() if not self.magic1 == b"\x44\x4B\x49\x46": raise kaitaistruct.ValidationNotEqualError(b"\x44\x4B\x49\x46", self.magic1, self._io, u"/seq/0") self._debug['version']['start'] = self._io.pos() self.version = self._io.read_u2le() self._debug['version']['end'] = self._io.pos() self._debug['len_header']['start'] = self._io.pos() self.len_header = self._io.read_u2le() self._debug['len_header']['end'] = self._io.pos() self._debug['codec']['start'] = self._io.pos() self.codec = self._io.read_bytes(4) self._debug['codec']['end'] = self._io.pos() if not self.codec == b"\x56\x50\x38\x30": raise kaitaistruct.ValidationNotEqualError(b"\x56\x50\x38\x30", self.codec, self._io, u"/seq/3") self._debug['width']['start'] = self._io.pos() self.width = self._io.read_u2le() self._debug['width']['end'] = self._io.pos() self._debug['height']['start'] = self._io.pos() self.height = self._io.read_u2le() self._debug['height']['end'] = self._io.pos() self._debug['framerate']['start'] = self._io.pos() self.framerate = self._io.read_u4le() self._debug['framerate']['end'] = self._io.pos() self._debug['timescale']['start'] = self._io.pos() self.timescale = self._io.read_u4le() self._debug['timescale']['end'] = self._io.pos() self._debug['num_frames']['start'] = self._io.pos() self.num_frames = self._io.read_u4le() self._debug['num_frames']['end'] = self._io.pos() self._debug['unused']['start'] = self._io.pos() self.unused = self._io.read_u4le() self._debug['unused']['end'] = self._io.pos() self._debug['image_data']['start'] = self._io.pos() self.image_data = [None] * (self.num_frames) for i in range(self.num_frames): if not 'arr' in self._debug['image_data']: self._debug['image_data']['arr'] = [] self._debug['image_data']['arr'].append({'start': self._io.pos()}) _t_image_data = Vp8Ivf.Blocks(self._io, self, self._root) _t_image_data._read() self.image_data[i] = _t_image_data self._debug['image_data']['arr'][i]['end'] = self._io.pos() self._debug['image_data']['end'] = self._io.pos()
def _read(self): self.len_data_dec = (self._io.read_bytes_term( 58, False, True, True)).decode(u"ASCII") self.opening_quote = self._io.read_bytes(1) if not self.opening_quote == b"\x22": raise kaitaistruct.ValidationNotEqualError( b"\x22", self.opening_quote, self._io, u"/types/length_prefixed_quoted_string/seq/1") self.data = self._io.read_bytes(self.len_data) self.closing_quote = self._io.read_bytes(1) if not self.closing_quote == b"\x22": raise kaitaistruct.ValidationNotEqualError( b"\x22", self.closing_quote, self._io, u"/types/length_prefixed_quoted_string/seq/3")
def _read(self): self.magic = self._io.read_bytes(8) if not self.magic == b"\x37\xE4\x53\x96\xC9\xDB\xD6\x07": raise kaitaistruct.ValidationNotEqualError(b"\x37\xE4\x53\x96\xC9\xDB\xD6\x07", self.magic, self._io, u"/types/header/seq/0") self.uncompressed_size = self._io.read_u4le() self.len_header = self._io.read_u1() if not self.len_header == 4: raise kaitaistruct.ValidationNotEqualError(4, self.len_header, self._io, u"/types/header/seq/2") self.block_size_log2 = self._io.read_u1() if not ((self.block_size_log2 == 15) or (self.block_size_log2 == 16) or (self.block_size_log2 == 17)) : raise kaitaistruct.ValidationNotAnyOfError(self.block_size_log2, self._io, u"/types/header/seq/3") self.reserved = self._io.read_bytes(2) if not self.reserved == b"\x00\x00": raise kaitaistruct.ValidationNotEqualError(b"\x00\x00", self.reserved, self._io, u"/types/header/seq/4")
def _read(self): self.unused1 = self._io.read_bytes(1) if not self.unused1 == b"\x00": raise kaitaistruct.ValidationNotEqualError( b"\x00", self.unused1, self._io, u"/types/vol_desc_primary/seq/0") self.system_id = (self._io.read_bytes(32)).decode(u"UTF-8") self.volume_id = (self._io.read_bytes(32)).decode(u"UTF-8") self.unused2 = self._io.read_bytes(8) if not self.unused2 == b"\x00\x00\x00\x00\x00\x00\x00\x00": raise kaitaistruct.ValidationNotEqualError( b"\x00\x00\x00\x00\x00\x00\x00\x00", self.unused2, self._io, u"/types/vol_desc_primary/seq/3") self.vol_space_size = Iso9660.U4bi(self._io, self, self._root) self.unused3 = self._io.read_bytes(32) if not self.unused3 == b"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00": raise kaitaistruct.ValidationNotEqualError( b"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", self.unused3, self._io, u"/types/vol_desc_primary/seq/5") self.vol_set_size = Iso9660.U2bi(self._io, self, self._root) self.vol_seq_num = Iso9660.U2bi(self._io, self, self._root) self.logical_block_size = Iso9660.U2bi(self._io, self, self._root) self.path_table_size = Iso9660.U4bi(self._io, self, self._root) self.lba_path_table_le = self._io.read_u4le() self.lba_opt_path_table_le = self._io.read_u4le() self.lba_path_table_be = self._io.read_u4be() self.lba_opt_path_table_be = self._io.read_u4be() self._raw_root_dir = self._io.read_bytes(34) _io__raw_root_dir = KaitaiStream(BytesIO(self._raw_root_dir)) self.root_dir = Iso9660.DirEntry(_io__raw_root_dir, self, self._root) self.vol_set_id = (self._io.read_bytes(128)).decode(u"UTF-8") self.publisher_id = (self._io.read_bytes(128)).decode(u"UTF-8") self.data_preparer_id = (self._io.read_bytes(128)).decode(u"UTF-8") self.application_id = (self._io.read_bytes(128)).decode(u"UTF-8") self.copyright_file_id = (self._io.read_bytes(38)).decode(u"UTF-8") self.abstract_file_id = (self._io.read_bytes(36)).decode(u"UTF-8") self.bibliographic_file_id = ( self._io.read_bytes(37)).decode(u"UTF-8") self.vol_create_datetime = Iso9660.DecDatetime( self._io, self, self._root) self.vol_mod_datetime = Iso9660.DecDatetime( self._io, self, self._root) self.vol_expire_datetime = Iso9660.DecDatetime( self._io, self, self._root) self.vol_effective_datetime = Iso9660.DecDatetime( self._io, self, self._root) self.file_structure_version = self._io.read_u1() self.unused4 = self._io.read_u1() self.application_area = self._io.read_bytes(512)
def _read(self): self.block_size = self._io.read_bytes(1) if not self.block_size == b"\x04": raise kaitaistruct.ValidationNotEqualError( b"\x04", self.block_size, self._io, u"/types/ext_graphic_control/seq/0") self.flags = self._io.read_u1() self.delay_time = self._io.read_u2le() self.transparent_idx = self._io.read_u1() self.terminator = self._io.read_bytes(1) if not self.terminator == b"\x00": raise kaitaistruct.ValidationNotEqualError( b"\x00", self.terminator, self._io, u"/types/ext_graphic_control/seq/4")
def _read(self): self.shebang = self._io.read_bytes(12) if not self.shebang == b"\x23\x21\x72\x74\x70\x70\x6C\x61\x79\x31\x2E\x30": raise kaitaistruct.ValidationNotEqualError(b"\x23\x21\x72\x74\x70\x70\x6C\x61\x79\x31\x2E\x30", self.shebang, self._io, u"/types/header_t/seq/0") self.space = self._io.read_bytes(1) if not self.space == b"\x20": raise kaitaistruct.ValidationNotEqualError(b"\x20", self.space, self._io, u"/types/header_t/seq/1") self.ip = (self._io.read_bytes_term(47, False, True, True)).decode(u"ascii") self.port = (self._io.read_bytes_term(10, False, True, True)).decode(u"ascii") self.start_sec = self._io.read_u4be() self.start_usec = self._io.read_u4be() self.ip2 = self._io.read_u4be() self.port2 = self._io.read_u2be() self.padding = self._io.read_u2be()
def _read(self): self.song_name = KaitaiStream.bytes_terminate(self._io.read_bytes(28), 0, False) self.magic1 = self._io.read_bytes(1) if not self.magic1 == b"\x1A": raise kaitaistruct.ValidationNotEqualError(b"\x1A", self.magic1, self._io, u"/seq/1") self.file_type = self._io.read_u1() self.reserved1 = self._io.read_bytes(2) self.num_orders = self._io.read_u2le() self.num_instruments = self._io.read_u2le() self.num_patterns = self._io.read_u2le() self.flags = self._io.read_u2le() self.version = self._io.read_u2le() self.samples_format = self._io.read_u2le() self.magic2 = self._io.read_bytes(4) if not self.magic2 == b"\x53\x43\x52\x4D": raise kaitaistruct.ValidationNotEqualError(b"\x53\x43\x52\x4D", self.magic2, self._io, u"/seq/10") self.global_volume = self._io.read_u1() self.initial_speed = self._io.read_u1() self.initial_tempo = self._io.read_u1() self.is_stereo = self._io.read_bits_int_be(1) != 0 self.master_volume = self._io.read_bits_int_be(7) self._io.align_to_byte() self.ultra_click_removal = self._io.read_u1() self.has_custom_pan = self._io.read_u1() self.reserved2 = self._io.read_bytes(8) self.ofs_special = self._io.read_u2le() self.channels = [] for i in range(32): self.channels.append(S3m.Channel(self._io, self, self._root)) self.orders = self._io.read_bytes(self.num_orders) self.instruments = [] for i in range(self.num_instruments): self.instruments.append( S3m.InstrumentPtr(self._io, self, self._root)) self.patterns = [] for i in range(self.num_patterns): self.patterns.append(S3m.PatternPtr(self._io, self, self._root)) if self.has_custom_pan == 252: self.channel_pans = [] for i in range(32): self.channel_pans.append( S3m.ChannelPan(self._io, self, self._root))
def _read(self): self.colon1 = self._io.read_bytes(1) if not self.colon1 == b"\x3A": raise kaitaistruct.ValidationNotEqualError( b"\x3A", self.colon1, self._io, u"/types/object_contents/seq/0") self.class_name = PhpSerializedValue.LengthPrefixedQuotedString( self._io, self, self._root) self.colon2 = self._io.read_bytes(1) if not self.colon2 == b"\x3A": raise kaitaistruct.ValidationNotEqualError( b"\x3A", self.colon2, self._io, u"/types/object_contents/seq/2") self.properties = PhpSerializedValue.CountPrefixedMapping( self._io, self, self._root)
def _read(self): self.magic1 = self._io.read_bytes(4) if not self.magic1 == b"\x52\x49\x46\x46": raise kaitaistruct.ValidationNotEqualError(b"\x52\x49\x46\x46", self.magic1, self._io, u"/seq/0") self.file_size = self._io.read_u4le() self.magic2 = self._io.read_bytes(4) if not self.magic2 == b"\x41\x56\x49\x20": raise kaitaistruct.ValidationNotEqualError(b"\x41\x56\x49\x20", self.magic2, self._io, u"/seq/2") self._raw_data = self._io.read_bytes((self.file_size - 4)) _io__raw_data = KaitaiStream(BytesIO(self._raw_data)) self.data = Avi.Blocks(_io__raw_data, self, self._root)
def _read(self): self.signature = (self._io.read_bytes_term(47, False, True, True)).decode(u"ascii") if not self.signature == self._parent.header.signature: raise kaitaistruct.ValidationNotEqualError( self._parent.header.signature, self.signature, self._io, u"/types/footer/seq/0") self.version_str = (self._io.read_bytes_term( 0, False, True, True)).decode(u"ascii") if not self.version_str == self._parent.header.version_str: raise kaitaistruct.ValidationNotEqualError( self._parent.header.version_str, self.version_str, self._io, u"/types/footer/seq/1") self.metadata_str = (KaitaiStream.bytes_terminate( self._io.read_bytes_full(), 0, False)).decode(u"ascii")
def _read(self): self._debug['magic']['start'] = self._io.pos() self.magic = self._io.read_bytes(4) self._debug['magic']['end'] = self._io.pos() if not self.magic == b"\x4E\x45\x53\x1A": raise kaitaistruct.ValidationNotEqualError( b"\x4E\x45\x53\x1A", self.magic, self._io, u"/types/header/seq/0") self._debug['len_prg_rom']['start'] = self._io.pos() self.len_prg_rom = self._io.read_u1() self._debug['len_prg_rom']['end'] = self._io.pos() self._debug['len_chr_rom']['start'] = self._io.pos() self.len_chr_rom = self._io.read_u1() self._debug['len_chr_rom']['end'] = self._io.pos() self._debug['f6']['start'] = self._io.pos() self._raw_f6 = self._io.read_bytes(1) _io__raw_f6 = KaitaiStream(BytesIO(self._raw_f6)) self.f6 = self._root.Header.F6(_io__raw_f6, self, self._root) self.f6._read() self._debug['f6']['end'] = self._io.pos() self._debug['f7']['start'] = self._io.pos() self._raw_f7 = self._io.read_bytes(1) _io__raw_f7 = KaitaiStream(BytesIO(self._raw_f7)) self.f7 = self._root.Header.F7(_io__raw_f7, self, self._root) self.f7._read() self._debug['f7']['end'] = self._io.pos() self._debug['len_prg_ram']['start'] = self._io.pos() self.len_prg_ram = self._io.read_u1() self._debug['len_prg_ram']['end'] = self._io.pos() self._debug['f9']['start'] = self._io.pos() self._raw_f9 = self._io.read_bytes(1) _io__raw_f9 = KaitaiStream(BytesIO(self._raw_f9)) self.f9 = self._root.Header.F9(_io__raw_f9, self, self._root) self.f9._read() self._debug['f9']['end'] = self._io.pos() self._debug['f10']['start'] = self._io.pos() self._raw_f10 = self._io.read_bytes(1) _io__raw_f10 = KaitaiStream(BytesIO(self._raw_f10)) self.f10 = self._root.Header.F10(_io__raw_f10, self, self._root) self.f10._read() self._debug['f10']['end'] = self._io.pos() self._debug['reserved']['start'] = self._io.pos() self.reserved = self._io.read_bytes(5) self._debug['reserved']['end'] = self._io.pos() if not self.reserved == b"\x00\x00\x00\x00\x00": raise kaitaistruct.ValidationNotEqualError( b"\x00\x00\x00\x00\x00", self.reserved, self._io, u"/types/header/seq/8")
def _read(self): self._debug['magic']['start'] = self._io.pos() self.magic = self._io.read_bytes(2) self._debug['magic']['end'] = self._io.pos() if not self.magic == b"\x50\x4B": raise kaitaistruct.ValidationNotEqualError( b"\x50\x4B", self.magic, self._io, u"/types/pk_section/seq/0") self._debug['section_type']['start'] = self._io.pos() self.section_type = self._io.read_u2le() self._debug['section_type']['end'] = self._io.pos() self._debug['body']['start'] = self._io.pos() _on = self.section_type if _on == 513: self.body = Zip.CentralDirEntry(self._io, self, self._root) self.body._read() elif _on == 1027: self.body = Zip.LocalFile(self._io, self, self._root) self.body._read() elif _on == 1541: self.body = Zip.EndOfCentralDir(self._io, self, self._root) self.body._read() elif _on == 2055: self.body = Zip.DataDescriptor(self._io, self, self._root) self.body._read() self._debug['body']['end'] = self._io.pos()
def _read(self): self.magic = self._io.read_bytes(13) if not self.magic == b"\x62\x74\x72\x66\x73\x2D\x73\x74\x72\x65\x61\x6D\x00": raise kaitaistruct.ValidationNotEqualError( b"\x62\x74\x72\x66\x73\x2D\x73\x74\x72\x65\x61\x6D\x00", self.magic, self._io, u"/types/send_stream_header/seq/0") self.version = self._io.read_u4le()
def _read(self): self.magic = self._io.read_bytes(4) if not self.magic == b"\x78\x61\x72\x21": raise kaitaistruct.ValidationNotEqualError( b"\x78\x61\x72\x21", self.magic, self._io, u"/types/file_header_prefix/seq/0") self.len_header = self._io.read_u2be()
def _read(self): self.len = self._io.read_s4le() self.str = (self._io.read_bytes((self.len - 1))).decode(u"UTF-8") self.terminator = self._io.read_bytes(1) if not self.terminator == b"\x00": raise kaitaistruct.ValidationNotEqualError( b"\x00", self.terminator, self._io, u"/types/string/seq/2")
def _read(self): self._debug['pe_signature']['start'] = self._io.pos() self.pe_signature = self._io.read_bytes(4) self._debug['pe_signature']['end'] = self._io.pos() if not self.pe_signature == b"\x50\x45\x00\x00": raise kaitaistruct.ValidationNotEqualError( b"\x50\x45\x00\x00", self.pe_signature, self._io, u"/types/pe_header/seq/0") self._debug['coff_hdr']['start'] = self._io.pos() self.coff_hdr = MicrosoftPe.CoffHeader(self._io, self, self._root) self.coff_hdr._read() self._debug['coff_hdr']['end'] = self._io.pos() self._debug['optional_hdr']['start'] = self._io.pos() self._raw_optional_hdr = self._io.read_bytes( self.coff_hdr.size_of_optional_header) _io__raw_optional_hdr = KaitaiStream( BytesIO(self._raw_optional_hdr)) self.optional_hdr = MicrosoftPe.OptionalHeader( _io__raw_optional_hdr, self, self._root) self.optional_hdr._read() self._debug['optional_hdr']['end'] = self._io.pos() self._debug['sections']['start'] = self._io.pos() self.sections = [None] * (self.coff_hdr.number_of_sections) for i in range(self.coff_hdr.number_of_sections): if not 'arr' in self._debug['sections']: self._debug['sections']['arr'] = [] self._debug['sections']['arr'].append( {'start': self._io.pos()}) _t_sections = MicrosoftPe.Section(self._io, self, self._root) _t_sections._read() self.sections[i] = _t_sections self._debug['sections']['arr'][i]['end'] = self._io.pos() self._debug['sections']['end'] = self._io.pos()
def _read(self): self._debug['pack_magic']['start'] = self._io.pos() self.pack_magic = KaitaiStream.resolve_enum(self._root.PackEnum, self._io.read_u4be()) self._debug['pack_magic']['end'] = self._io.pos() self._debug['dat_magic']['start'] = self._io.pos() self.dat_magic = self._io.read_bytes(4) self._debug['dat_magic']['end'] = self._io.pos() if not self.dat_magic == b"\x41\x4C\x4C\x2E": raise kaitaistruct.ValidationNotEqualError(b"\x41\x4C\x4C\x2E", self.dat_magic, self._io, u"/seq/1") self._debug['num_objects']['start'] = self._io.pos() self.num_objects = self._io.read_u4be() self._debug['num_objects']['end'] = self._io.pos() self._debug['objects']['start'] = self._io.pos() self.objects = [None] * (self.num_objects) for i in range(self.num_objects): if not 'arr' in self._debug['objects']: self._debug['objects']['arr'] = [] self._debug['objects']['arr'].append({'start': self._io.pos()}) _t_objects = self._root.DatObject(self._io, self, self._root) _t_objects._read() self.objects[i] = _t_objects self._debug['objects']['arr'][i]['end'] = self._io.pos() self._debug['objects']['end'] = self._io.pos()
def _read(self): self.message_header = self._io.read_u1() _on = self.message_type if _on == HyteraDmrApplicationProtocol.MessageHeaderTypes.radio_registration: self.data = radio_registration_service.RadioRegistrationService( self._io) elif _on == HyteraDmrApplicationProtocol.MessageHeaderTypes.telemetry_protocol: self.data = telemetry_protocol.TelemetryProtocol(self._io) elif (_on == HyteraDmrApplicationProtocol.MessageHeaderTypes. radio_control_protocol): self.data = radio_control_protocol.RadioControlProtocol(self._io) elif (_on == HyteraDmrApplicationProtocol.MessageHeaderTypes. text_message_protocol): self.data = text_message_protocol.TextMessageProtocol(self._io) elif (_on == HyteraDmrApplicationProtocol.MessageHeaderTypes. data_delivery_states): self.data = data_delivery_states.DataDeliveryStates(self._io) elif _on == HyteraDmrApplicationProtocol.MessageHeaderTypes.location_protocol: self.data = location_protocol.LocationProtocol(self._io) elif (_on == HyteraDmrApplicationProtocol.MessageHeaderTypes. data_transmit_protocol): self.data = data_transmit_protocol.DataTransmitProtocol(self._io) self.checksum = self._io.read_u1() self.message_footer = self._io.read_bytes(1) if not self.message_footer == b"\x03": raise kaitaistruct.ValidationNotEqualError(b"\x03", self.message_footer, self._io, u"/seq/3")
def _read(self): self._debug['compression']['start'] = self._io.pos() self.compression = KaitaiStream.resolve_enum(Swf.Compressions, self._io.read_u1()) self._debug['compression']['end'] = self._io.pos() self._debug['signature']['start'] = self._io.pos() self.signature = self._io.read_bytes(2) self._debug['signature']['end'] = self._io.pos() if not self.signature == b"\x57\x53": raise kaitaistruct.ValidationNotEqualError(b"\x57\x53", self.signature, self._io, u"/seq/1") self._debug['version']['start'] = self._io.pos() self.version = self._io.read_u1() self._debug['version']['end'] = self._io.pos() self._debug['len_file']['start'] = self._io.pos() self.len_file = self._io.read_u4le() self._debug['len_file']['end'] = self._io.pos() if self.compression == Swf.Compressions.none: self._debug['plain_body']['start'] = self._io.pos() self._raw_plain_body = self._io.read_bytes_full() _io__raw_plain_body = KaitaiStream(BytesIO(self._raw_plain_body)) self.plain_body = Swf.SwfBody(_io__raw_plain_body, self, self._root) self.plain_body._read() self._debug['plain_body']['end'] = self._io.pos() if self.compression == Swf.Compressions.zlib: self._debug['zlib_body']['start'] = self._io.pos() self._raw__raw_zlib_body = self._io.read_bytes_full() self._raw_zlib_body = zlib.decompress(self._raw__raw_zlib_body) _io__raw_zlib_body = KaitaiStream(BytesIO(self._raw_zlib_body)) self.zlib_body = Swf.SwfBody(_io__raw_zlib_body, self, self._root) self.zlib_body._read() self._debug['zlib_body']['end'] = self._io.pos()
def _read(self): self.file_part_type_de = self._io.read_bytes(2) if not self.file_part_type_de == b"\x44\x45": raise kaitaistruct.ValidationNotEqualError(b"\x44\x45", self.file_part_type_de, self._io, u"/types/data_sub_header_base/seq/0") self.desid = (self._io.read_bytes(25)).decode(u"UTF-8") self.data_definition_version = (self._io.read_bytes(2)).decode(u"UTF-8") self.declasnfo = Nitf.Clasnfo(self._io, self, self._root)
def _read(self): self._debug['width']['start'] = self._io.pos() self.width = self._io.read_u1() self._debug['width']['end'] = self._io.pos() self._debug['height']['start'] = self._io.pos() self.height = self._io.read_u1() self._debug['height']['end'] = self._io.pos() self._debug['num_colors']['start'] = self._io.pos() self.num_colors = self._io.read_u1() self._debug['num_colors']['end'] = self._io.pos() self._debug['reserved']['start'] = self._io.pos() self.reserved = self._io.read_bytes(1) self._debug['reserved']['end'] = self._io.pos() if not self.reserved == b"\x00": raise kaitaistruct.ValidationNotEqualError(b"\x00", self.reserved, self._io, u"/types/icon_dir_entry/seq/3") self._debug['num_planes']['start'] = self._io.pos() self.num_planes = self._io.read_u2le() self._debug['num_planes']['end'] = self._io.pos() self._debug['bpp']['start'] = self._io.pos() self.bpp = self._io.read_u2le() self._debug['bpp']['end'] = self._io.pos() self._debug['len_img']['start'] = self._io.pos() self.len_img = self._io.read_u4le() self._debug['len_img']['end'] = self._io.pos() self._debug['ofs_img']['start'] = self._io.pos() self.ofs_img = self._io.read_u4le() self._debug['ofs_img']['end'] = self._io.pos()
def _read(self): self._debug['type']['start'] = self._io.pos() self.type = KaitaiStream.resolve_enum(S3m.Instrument.InstTypes, self._io.read_u1()) self._debug['type']['end'] = self._io.pos() self._debug['filename']['start'] = self._io.pos() self.filename = KaitaiStream.bytes_terminate( self._io.read_bytes(12), 0, False) self._debug['filename']['end'] = self._io.pos() self._debug['body']['start'] = self._io.pos() _on = self.type if _on == S3m.Instrument.InstTypes.sample: self.body = S3m.Instrument.Sampled(self._io, self, self._root) self.body._read() else: self.body = S3m.Instrument.Adlib(self._io, self, self._root) self.body._read() self._debug['body']['end'] = self._io.pos() self._debug['tuning_hz']['start'] = self._io.pos() self.tuning_hz = self._io.read_u4le() self._debug['tuning_hz']['end'] = self._io.pos() self._debug['reserved2']['start'] = self._io.pos() self.reserved2 = self._io.read_bytes(12) self._debug['reserved2']['end'] = self._io.pos() self._debug['sample_name']['start'] = self._io.pos() self.sample_name = KaitaiStream.bytes_terminate( self._io.read_bytes(28), 0, False) self._debug['sample_name']['end'] = self._io.pos() self._debug['magic']['start'] = self._io.pos() self.magic = self._io.read_bytes(4) self._debug['magic']['end'] = self._io.pos() if not self.magic == b"\x53\x43\x52\x53": raise kaitaistruct.ValidationNotEqualError( b"\x53\x43\x52\x53", self.magic, self._io, u"/types/instrument/seq/6")
def _read(self): self._debug['magic']['start'] = self._io.pos() self.magic = self._io.read_bytes(8) self._debug['magic']['end'] = self._io.pos() if not self.magic == b"\x23\x4F\x50\x4C\x5F\x49\x49\x23": raise kaitaistruct.ValidationNotEqualError( b"\x23\x4F\x50\x4C\x5F\x49\x49\x23", self.magic, self._io, u"/seq/0") self._debug['instruments']['start'] = self._io.pos() self.instruments = [None] * (175) for i in range(175): if not 'arr' in self._debug['instruments']: self._debug['instruments']['arr'] = [] self._debug['instruments']['arr'].append({'start': self._io.pos()}) _t_instruments = GenmidiOp2.InstrumentEntry( self._io, self, self._root) _t_instruments._read() self.instruments[i] = _t_instruments self._debug['instruments']['arr'][i]['end'] = self._io.pos() self._debug['instruments']['end'] = self._io.pos() self._debug['instrument_names']['start'] = self._io.pos() self.instrument_names = [None] * (175) for i in range(175): if not 'arr' in self._debug['instrument_names']: self._debug['instrument_names']['arr'] = [] self._debug['instrument_names']['arr'].append( {'start': self._io.pos()}) self.instrument_names[i] = (KaitaiStream.bytes_terminate( KaitaiStream.bytes_strip_right(self._io.read_bytes(32), 0), 0, False)).decode(u"ASCII") self._debug['instrument_names']['arr'][i]['end'] = self._io.pos() self._debug['instrument_names']['end'] = self._io.pos()