예제 #1
0
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"]
예제 #2
0
def generalELFInfo(elffile):
    """
    Display general header information from the ELF file
    """
    banner("General ELF Info")
    print "=== Architecture: %s" % elffile.get_machine_arch()
    print "=== Has DWARF Info: %s" % elffile.has_dwarf_info()
    print "=== Number of Sections: %d" % elffile.num_sections()
    print "=== Number of Segments: %d" % elffile.num_segments()
    print "=== Entry EIP: 0x%x" % elffile.header["e_entry"]
    print "=== ELF Header Info:"
    print elffile.header
예제 #3
0
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)