def __bytes__(self): st_name = uint32(self.st_name, little=self.little) st_value = uint32(self.st_value, little=self.little) st_size = uint32(self.st_size, little=self.little) st_info = uint8(self.st_info, little=self.little) st_other = uint8(self.st_other, little=self.little) st_shndx = uint16(self.st_shndx, little=self.little) return bytes(st_name) + bytes(st_value) + bytes(st_size) + \ bytes(st_info) + bytes(st_other) + bytes(st_shndx)
def __bytes__(self): little = self.little e_type = bytes(self.e_type) e_machine = bytes(self.e_machine) e_version = uint32(self.e_version, little) e_entry = uint32(self.e_entry, little) e_phoff = uint32(self.e_phoff, little) e_shoff = uint32(self.e_shoff, little) e_flags = uint32(self.e_flags, little) e_ehsize = uint16(self.e_ehsize, little) e_phentsize = uint16(self.e_phentsize, little) e_phnum = uint16(self.e_phnum, little) e_shentsize = uint16(self.e_shentsize, little) e_shnum = uint16(self.e_shnum, little) e_shstrndx = uint16(self.e_shstrndx, little) if self.little: e_type = bytes(reversed(e_type)) e_machine = bytes(reversed(e_machine)) b = bytes(self.e_ident) + bytes(e_type) + bytes(e_machine) + \ bytes(e_version) + bytes(e_entry) + bytes(e_phoff) + \ bytes(e_shoff) + bytes(e_flags) + bytes(e_ehsize) + \ bytes(e_phentsize) + bytes(e_phnum) + bytes(e_shentsize) + \ bytes(e_shnum) + bytes(e_shstrndx) return b