From 187cf13a6f0b0ddbb46fd563d66bb01b0dcd18be Mon Sep 17 00:00:00 2001
From: Cyrille Bagard <nocbos@gmail.com>
Date: Mon, 16 Nov 2020 18:15:13 +0100
Subject: Updated code to the new Python API for the Elf format.

---
 plugins/python/checksec/mitigations.py | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/plugins/python/checksec/mitigations.py b/plugins/python/checksec/mitigations.py
index 1539fa7..f054fac 100644
--- a/plugins/python/checksec/mitigations.py
+++ b/plugins/python/checksec/mitigations.py
@@ -28,9 +28,9 @@ class ElfMitigations():
 
         # -Wl,-z,execstack / -Wl,-z,noexecstack
 
-        stack = self._fmt.find_program_by_type(ElfFormat.PT_GNU_STACK)
+        stack = self._fmt.find_program_by_type(ElfFormat.ElfProgramHeaderType.PT_GNU_STACK)
 
-        status = stack is None or stack.p_flags & ElfFormat.PF_X
+        status = stack is None or stack.p_flags & ElfFormat.ElfProgramHeaderFlags.PF_X
 
         return 'No' if status else 'Yes'
 
@@ -44,7 +44,7 @@ class ElfMitigations():
 
         hdr = self._fmt.get_header()
 
-        status = hdr.e_type == ElfFormat.ET_DYN
+        status = hdr.e_type == ElfFormat.ElfHeaderType.ET_DYN
 
         return 'Yes' if status else 'No'
 
@@ -57,9 +57,9 @@ class ElfMitigations():
 
         # -Wl,-z,relro / -Wl,-z,now
 
-        prgm = self._fmt.find_program_by_type(ElfFormat.PT_GNU_RELRO)
+        prgm = self._fmt.find_program_by_type(ElfFormat.ElfProgramHeaderType.PT_GNU_RELRO)
 
-        entry = self._fmt.find_dynamic_item_by_type(ElfFormat.DT_BIND_NOW)
+        entry = self._fmt.find_dynamic_item_by_type(ElfFormat.ElfSectionHeaderFlags.DT_BIND_NOW)
 
         if prgm is None and entry is None:
             status = 'No'
-- 
cgit v0.11.2-87-g4458