def sectionInfo(elffile): """ Display the ELF file's section names and types. """ banner("Section Info") for idx in range(elffile.num_sections()): sec = elffile.get_section(idx) print "Section %d: '%s'" % (idx, sec.name), print sec.header["sh_type"]
def symbolInfo(elffile, demangle): """ Show symbols in ELF file """ banner("Symbol Info") for idx in range(elffile.num_sections()): sec = elffile.get_section(idx) # pyelftools creates a SymbolTableSection for SHT_SYMTAB and # SHT_DYNSYM sections if isinstance(sec, elftools.elf.sections.SymbolTableSection): print "Found a symbol table in section %d (%s)" % (idx, sec.name) for sym in sec.iter_symbols(): singleSymbolInfo(sym, demangle)