|
5 | 5 | from pathlib import Path |
6 | 6 | from tempfile import NamedTemporaryFile |
7 | 7 |
|
8 | | -from checksec.elf import ELFSecurity, PIEType, RelroType |
| 8 | +from checksec.elf import ELFSecurity, PIEType, RelroType, set_libc |
9 | 9 | from checksec.errors import ErrorNotAnElf, ErrorParsingFailed |
10 | 10 | from see import Hook |
11 | 11 |
|
@@ -113,6 +113,8 @@ def download_libc(self, event): |
113 | 113 | # copy libc |
114 | 114 | shutil.copy(libc_inode.local_file, self.local_guest_libc.name) |
115 | 115 | self.logger.info("Copied guest libc %s to %s", libc_inode.path, self.local_guest_libc.name) |
| 116 | + # setup checksec libc |
| 117 | + set_libc(Path(self.local_guest_libc.name)) |
116 | 118 |
|
117 | 119 | def check_file(self, event): |
118 | 120 | # event args |
@@ -146,16 +148,16 @@ def check_file(self, event): |
146 | 148 | shutil.copy(inode.local_file, dst) |
147 | 149 | return |
148 | 150 | else: |
149 | | - relro = elf.has_relro |
| 151 | + relro = elf.relro |
150 | 152 | canary = elf.has_canary |
151 | 153 | nx = elf.has_nx |
152 | | - pie = elf.is_pie |
| 154 | + pie = elf.pie |
153 | 155 | rpath = elf.has_rpath |
154 | 156 | runpath = elf.has_runpath |
155 | 157 | symbols = not elf.is_stripped |
156 | 158 | fortified = elf.is_fortified |
157 | | - fortify_source = 0 # TODO |
158 | | - fortifyable = 0 # TODO |
| 159 | + fortify_source = len(elf.fortified) |
| 160 | + fortifyable = len(elf.fortifiable) |
159 | 161 |
|
160 | 162 | checksec_file = ChecksecFile(relro, canary, nx, pie, rpath, runpath, |
161 | 163 | symbols, fortify_source, fortified, fortifyable) |
|
0 commit comments