scripts: match on exe type over str in symbol-check.py

This commit is contained in:
fanquake 2021-12-18 11:41:49 +08:00
parent feee308401
commit d1711a40b3
No known key found for this signature in database
GPG Key ID: 2EEB9F5CC09526C1

View File

@ -254,18 +254,18 @@ def check_ELF_interpreter(binary) -> bool:
return binary.concrete.interpreter == expected_interpreter
CHECKS = {
'ELF': [
lief.EXE_FORMATS.ELF: [
('IMPORTED_SYMBOLS', check_imported_symbols),
('EXPORTED_SYMBOLS', check_exported_symbols),
('LIBRARY_DEPENDENCIES', check_ELF_libraries),
('INTERPRETER_NAME', check_ELF_interpreter),
],
'MACHO': [
lief.EXE_FORMATS.MACHO: [
('DYNAMIC_LIBRARIES', check_MACHO_libraries),
('MIN_OS', check_MACHO_min_os),
('SDK', check_MACHO_sdk),
],
'PE' : [
lief.EXE_FORMATS.PE: [
('DYNAMIC_LIBRARIES', check_PE_libraries),
('SUBSYSTEM_VERSION', check_PE_subsystem_version),
]
@ -276,7 +276,7 @@ if __name__ == '__main__':
for filename in sys.argv[1:]:
try:
binary = lief.parse(filename)
etype = binary.format.name
etype = binary.format
if etype == lief.EXE_FORMATS.UNKNOWN:
print(f'{filename}: unknown executable format')
retval = 1