diff options
author | fanquake <fanquake@gmail.com> | 2021-12-18 11:41:36 +0800 |
---|---|---|
committer | fanquake <fanquake@gmail.com> | 2021-12-18 11:41:36 +0800 |
commit | feee308401835456e00171e0b909c611c752d3e6 (patch) | |
tree | eea844207301356e157ed13b6d6db4519ce706d5 /contrib | |
parent | 97b2fc03f666ccbadcd3a497303fb6577842d11f (diff) |
scripts: match on exe type over str in security-check.py
Diffstat (limited to 'contrib')
-rwxr-xr-x | contrib/devtools/security-check.py | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/contrib/devtools/security-check.py b/contrib/devtools/security-check.py index 677557b8fa..edbb97aa4e 100755 --- a/contrib/devtools/security-check.py +++ b/contrib/devtools/security-check.py @@ -180,14 +180,14 @@ def check_control_flow(binary) -> bool: CHECKS = { -'ELF': [ +lief.EXE_FORMATS.ELF: [ ('PIE', check_PIE), ('NX', check_NX), ('RELRO', check_ELF_RELRO), ('Canary', check_ELF_Canary), ('separate_code', check_ELF_separate_code), ], -'PE': [ +lief.EXE_FORMATS.PE: [ ('PIE', check_PIE), ('DYNAMIC_BASE', check_PE_DYNAMIC_BASE), ('HIGH_ENTROPY_VA', check_PE_HIGH_ENTROPY_VA), @@ -195,7 +195,7 @@ CHECKS = { ('RELOC_SECTION', check_PE_RELOC_SECTION), ('CONTROL_FLOW', check_PE_control_flow), ], -'MACHO': [ +lief.EXE_FORMATS.MACHO: [ ('PIE', check_PIE), ('NOUNDEFS', check_MACHO_NOUNDEFS), ('NX', check_NX), @@ -210,7 +210,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 |