Пример #1
0
 def get_raw_sections(self):
     for (index,h) in enumerate(self.sectionheaders):
         sectionx = UF.get_elf_section_xnode(self.get_path(),self.get_filename(),index)
         if sectionx is None:
             print('Section ' + str(index) + ' could not be found')
             continue
         else:
             self.sections[index] = ELFSection(self,sectionx,self.sectionheaders[index])
 def get_string_table(self, index: int) -> ELFSection:
     if index in self._sections:
         return self._sections[index]
     else:
         sectionx = UF.get_elf_section_xnode(self.pathname, self.filename,
                                             str(index))
         self._sections[index] = ELFStringTable(self,
                                                self.sectionheaders[index],
                                                sectionx)
         return self._sections[index]
 def get_dynamic_table(self) -> ELFSection:
     index = self.get_dynamic_table_index()
     if index in self.sections:
         return self.sections[index]
     else:
         xsection = UF.get_elf_section_xnode(self.pathname, self.filename,
                                             str(index))
         self.sections[index] = ELFDynamicTable(self,
                                                self.sectionheaders[index],
                                                xsection)
         return self.sections[index]
Пример #4
0
 def get_string_table(self,index):
     if index in self.sections:
         return self.sections[index]
     else:
         sectionx = UF.get_elf_section_xnode(self.app.path,self.app.filename,index)
         if sectionx is None:
             print('Section ' + str(index) + ' could not be found')
             return
         else:
             self.sections[index] = ELFStringTable(self,sectionx,self.sectionheaders[index])
             return self.sections[index]
Пример #5
0
 def get_dynamic_symbol_table(self):
     index = self.get_dynamic_symbol_table_index()
     if index in self.sections:
         return self.sections[index]
     else:
         sectionx = UF.get_elf_section_xnode(self.app.path,self.app.filename,index)
         if sectionx is None:
             print('Section ' + str(index) + ' could not be found')
             return
         else:
             self.sections[index] = ELFSymbolTable(self,sectionx,self.sectionheaders[index])
             return self.sections[index]
 def get_relocation_tables(
         self) -> List[Tuple[ELFSectionHeader, ELFSection]]:
     result: List[Tuple[ELFSectionHeader, ELFSection]] = []
     for sh in self.sectionheaders:
         if sh.is_relocation_table:
             if sh.index not in self.sections:
                 xsection = UF.get_elf_section_xnode(
                     self.pathname, self.filename, sh.index)
                 index = int(sh.index)
                 self._sections[index] = ELFRelocationTable(
                     self, self.sectionheaders[index], xsection)
             result.append((sh, self.sections[index]))
     return result
 def get_string_tables(self) -> List[ELFSection]:
     indices = self.get_string_table_indices()
     result: List[ELFSection] = []
     for index in indices:
         if index in self._sections:
             result.append(self._sections[index])
         else:
             sectionx = UF.get_elf_section_xnode(self.pathname,
                                                 self.filename, str(index))
             self._sections[index] = ELFStringTable(
                 self, self.sectionheaders[index], sectionx)
             result.append(self._sections[index])
     return result
Пример #8
0
 def get_relocation_tables(self):
     result = []
     for sh in self.sectionheaders:
         if sh.is_relocation_table():
             if not sh.index in self.sections:
                 sectionx = UF.get_elf_section_xnode(self.app.path,self.app.filename,sh.index)
             if sectionx is None:
                 print('Section ' + str(index) + ' could not be found')
                 continue
             else:
                 self.sections[sh.index] = ELFRelocationTable(self,sectionx,self.sectionheaders[sh.index])
             result.append((sh,self.sections[sh.index]))
     return result
Пример #9
0
 def get_string_tables(self):
     indices = self.get_string_table_indices()
     result = []
     for index in indices:
         if index in self.sections:
             result.append(self.sections[index])
         else:
             sectionx = UF.get_elf_section_xnode(self.app.path,self.app.filename,index)
             if sectionx is None:
                 print('Section ' + str(index) + ' could not be found')
                 return
             else:
                 self.sections[index] = ELFStringTable(self,sectionx,self.sectionheaders[index])
                 result.append(self.sections[index])
     return result
 def sections(self) -> Dict[int, ELFSection]:
     for (index, h) in enumerate(self.sectionheaders):
         if index in self._sections:
             continue
         xsection = UF.get_elf_section_xnode(self.pathname, self.filename,
                                             str(index))
         if h.is_dynamic_table:
             self._sections[index] = ELFDynamicTable(
                 self, self.sectionheaders[index], xsection)
         elif h.is_string_table:
             self._sections[index] = ELFStringTable(
                 self, self.sectionheaders[index], xsection)
         elif h.is_dynamic_symbol_table or h.is_symbol_table:
             self._sections[index] = ELFSymbolTable(
                 self, self.sectionheaders[index], xsection)
         else:
             self._sections[index] = ELFSection(self,
                                                self.sectionheaders[index],
                                                xsection)
     return self._sections