def _parseSegments(self, data, elfHeader):
        """Return a list of segments"""
        offset = elfHeader.header.e_phoff
        segments = []
        for i in range(elfHeader.header.e_phnum):
            phdr = self.__classes.PHDR.from_buffer(data, offset)
            segment_bytes = (c_ubyte * phdr.p_filesz).from_buffer(data, phdr.p_offset)

            phdrData = PhdrData(header=phdr, raw=segment_bytes, bytes=bytearray(segment_bytes), type=PT[phdr.p_type], vaddr=phdr.p_vaddr, offset=phdr.p_offset)
            segments.append(phdrData)

            offset += elfHeader.header.e_phentsize

        return segments
def _parseSegments ( self , data , elfHeader ) : offset = elfHeader . header . e_phoff segments = [ ] for i in range ( elfHeader . header . e_phnum ) : phdr = self . __classes . PHDR . from_buffer ( data , offset ) segment_bytes = ( c_ubyte * phdr . p_filesz ) . from_buffer ( data , phdr . p_offset ) phdrData = PhdrData ( header = phdr , raw = segment_bytes , bytes = bytearray ( segment_bytes ) , type = PT [ phdr . p_type ] , vaddr = phdr . p_vaddr , offset = phdr . p_offset ) segments . append ( phdrData ) offset += elfHeader . header . e_phentsize return segments
Return a list of segments