def load_binary(self, filename=None, offset=None, filemap=None): """ Loads the ELF file into a memory mapped file """ if filename == None: filename = self.prop.filename self.prop.file_src = open(filename, 'r+') self.prop.map_src = mmap(self.prop.file_src.fileno(), 0, access=self.prop.mode) Chunk.load(self, offset, filemap)
def load(self, offset=None, filemap=None): """ Loads header fields according to descriptions/format """ Chunk.load(self, offset, filemap) fields = list(unpack_from(''.join([self.prop.endian]+self.format), self.data)) idx = 0 for fmt in self.format: if fmt[len(fmt)-1] not in [ 's', 'p' ] and ( fmt[:len(fmt)-1].isdigit() == True): v = idx self.fields += [()] for n in range (0, int(fmt[:len(fmt)-1])): self.fields[v] += (fields[idx],) idx += 1 else: self.fields += [fields[idx]] idx += 1
def load(self, offset=None, filemap=None): """ Loads header fields according to descriptions/format """ Chunk.load(self, offset, filemap) fields = list( unpack_from(''.join([self.prop.endian] + self.format), self.data)) idx = 0 for fmt in self.format: if fmt[len(fmt) - 1] not in [ 's', 'p' ] and (fmt[:len(fmt) - 1].isdigit() == True): v = idx self.fields += [()] for n in range(0, int(fmt[:len(fmt) - 1])): self.fields[v] += (fields[idx], ) idx += 1 else: self.fields += [fields[idx]] idx += 1