An ELF format file stores the type of architecture. There is a dictionary in pyelftools :
ENUM_E_MACHINE = dict ( EM_NONE = 0, # No machine EM_M32 = 1, # AT&T WE 32100 EM_SPARC = 2, # SPARC ... ) The user interface is adapted to return the strings from this enum .
But it is required to get number from the dictionary (it turns out to get a line). For example :
print something.elf['e_machine'] print something.elf.header.e_machine It displays the string. For example, EM_X86_64 or EM_M32 . How does this library directly or indirectly get a number from the dictionary that corresponds to the type of machine, and not a string?
ENUM_E_MACHINE[something.elf['e_machine'] ]? - Vasyl Kolomiets