diff --git a/CHANGELOG.md b/CHANGELOG.md index f833daf9a..fad3a4dd9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -80,6 +80,7 @@ The table below shows which release corresponds to each branch, and what date th - [#2413][2413] libcdb: improve the search speed of `search_by_symbol_offsets` in local libc-database - [#2470][2470] Fix waiting for gdb under WSL2 - [#2479][2479] Support extracting libraries from Docker image in `pwn template` +- [#2483][2483] Only print `checksec` output of `ELF.libc` when it was printed for the `ELF` already [2471]: https://github.com/Gallopsled/pwntools/pull/2471 [2358]: https://github.com/Gallopsled/pwntools/pull/2358 @@ -88,6 +89,7 @@ The table below shows which release corresponds to each branch, and what date th [2413]: https://github.com/Gallopsled/pwntools/pull/2413 [2470]: https://github.com/Gallopsled/pwntools/pull/2470 [2479]: https://github.com/Gallopsled/pwntools/pull/2479 +[2483]: https://github.com/Gallopsled/pwntools/pull/2483 ## 4.14.0 (`beta`) diff --git a/pwnlib/elf/elf.py b/pwnlib/elf/elf.py index 777d6d214..02668f0a9 100644 --- a/pwnlib/elf/elf.py +++ b/pwnlib/elf/elf.py @@ -358,6 +358,7 @@ def __init__(self, path, checksec=True): self._populate_functions() self._populate_kernel_version() + self._print_checksec = checksec if checksec: self._describe() @@ -730,12 +731,13 @@ def libc(self): """:class:`.ELF`: If this :class:`.ELF` imports any libraries which contain ``'libc[.-]``, and we can determine the appropriate path to it on the local system, returns a new :class:`.ELF` object pertaining to that library. + Prints the `checksec` output of the library if it was printed for the original ELF too. If not found, the value will be :const:`None`. """ for lib in self.libs: if '/libc.' in lib or '/libc-' in lib: - return ELF(lib) + return ELF(lib, self._print_checksec) def _populate_libraries(self): """