shell pip install pyelftools python from elftools.elf.elffile import ELFFile python with open('example.elf', 'rb') as file: elf_file = ELFFile(file) python symbol_table = elf_file.get_section_by_name('.symtab') python for symbol in symbol_table.iter_symbols(): print('Symbol name: %s, Value: %s, Size: %s' % (symbol.name, hex(symbol['st_value']), symbol['st_size'])) python from elftools.elf.elffile import ELFFile def get_symbol_table(elf_file_path): # Open ELF file with open(elf_file_path, 'rb') as file: elf_file = ELFFile(file) # Get symbol table symbol_table = elf_file.get_section_by_name('.symtab') # Print symbol table information for symbol in symbol_table.iter_symbols(): print('Symbol name: %s, Value: %s, Size: %s' % (symbol.name, hex(symbol['st_value']), symbol['st_size'])) # Usage example get_symbol_table('example.elf')


上一篇:
下一篇:
切换中文