aboutsummaryrefslogtreecommitdiff
path: root/contrib/devtools
diff options
context:
space:
mode:
authorfanquake <fanquake@gmail.com>2021-12-18 11:41:36 +0800
committerfanquake <fanquake@gmail.com>2021-12-18 11:41:36 +0800
commitfeee308401835456e00171e0b909c611c752d3e6 (patch)
treeeea844207301356e157ed13b6d6db4519ce706d5 /contrib/devtools
parent97b2fc03f666ccbadcd3a497303fb6577842d11f (diff)
scripts: match on exe type over str in security-check.py
Diffstat (limited to 'contrib/devtools')
-rwxr-xr-xcontrib/devtools/security-check.py8
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