コード例 #1
0
ファイル: elftest.py プロジェクト: bjoernd/playground
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
ファイル: elftest.py プロジェクト: bjoernd/playground
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
ファイル: elftest.py プロジェクト: bjoernd/playground
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)