Пример #1
0
    def read_phdrs(self, at_phdr=None, at_phnum=None):
        '''
        Using the auxv array information, read and populate the phdrs list.

        @type  at_phdr: Integer 
        @param at_phdr: Location of the program headers

        @type  at_phnum: Integer
        @param at_phnum: Number of program headers
        '''

        if at_phdr == None:
            print "Location (AT_PHDR) could not be read, exiting"
            self.doexit()
        if at_phnum == None:
            print "Number (AT_PHNUM) could not be read, exiting"
            self.doexit()

        location = at_phdr

        for count in xrange(at_phnum):
            if CPU_WORD_SIZE == 4:
                length = len(Elf.Elf32Pheader())
                self.phdrs.append(\
                    Elf.Elf32Pheader(self.read_memory_libc(location,length)))
            elif CPU_WORD_SIZE == 8:
                length = len(Elf.Elf64Pheader())
                self.phdrs.append(\
                    Elf.Elf64Pheader(self.read_memory_libc(location,length)))

            location = location + length