From 4aaf9a1b52f312aca5326c9fea952ba5e619b4a1 Mon Sep 17 00:00:00 2001 From: Peace-Maker Date: Thu, 3 Oct 2024 10:23:28 +0200 Subject: [PATCH 1/2] Only print `checksec` output of `ELF.libc` when it was printed for the `ELF` already --- pwnlib/elf/elf.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pwnlib/elf/elf.py b/pwnlib/elf/elf.py index e8246db3b..c6ea5ceb2 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): """ From 8d361b471553204198a91b60c6951b6afbfe9ce4 Mon Sep 17 00:00:00 2001 From: Peace-Maker Date: Thu, 3 Oct 2024 11:28:21 +0200 Subject: [PATCH 2/2] Update CHANGELOG --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index a80edfb05..3e8309d22 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -79,6 +79,7 @@ The table below shows which release corresponds to each branch, and what date th - [#2444][2444] Add `ELF.close()` to release resources - [#2413][2413] libcdb: improve the search speed of `search_by_symbol_offsets` in local libc-database - [#2470][2470] Fix waiting for gdb under WSL2 +- [#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 @@ -86,6 +87,7 @@ The table below shows which release corresponds to each branch, and what date th [2444]: https://github.com/Gallopsled/pwntools/pull/2444 [2413]: https://github.com/Gallopsled/pwntools/pull/2413 [2470]: https://github.com/Gallopsled/pwntools/pull/2470 +[2483]: https://github.com/Gallopsled/pwntools/pull/2483 ## 4.14.0 (`beta`)