Skip to content

Commit 584ecca

Browse files
authored
Only print checksec output of ELF.libc when it was printed for the ELF already (#2483)
* Only print `checksec` output of `ELF.libc` when it was printed for the `ELF` already * Update CHANGELOG
1 parent 7dceedd commit 584ecca

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ The table below shows which release corresponds to each branch, and what date th
8080
- [#2413][2413] libcdb: improve the search speed of `search_by_symbol_offsets` in local libc-database
8181
- [#2470][2470] Fix waiting for gdb under WSL2
8282
- [#2479][2479] Support extracting libraries from Docker image in `pwn template`
83+
- [#2483][2483] Only print `checksec` output of `ELF.libc` when it was printed for the `ELF` already
8384

8485
[2471]: https://github.com/Gallopsled/pwntools/pull/2471
8586
[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
8889
[2413]: https://github.com/Gallopsled/pwntools/pull/2413
8990
[2470]: https://github.com/Gallopsled/pwntools/pull/2470
9091
[2479]: https://github.com/Gallopsled/pwntools/pull/2479
92+
[2483]: https://github.com/Gallopsled/pwntools/pull/2483
9193

9294
## 4.14.0 (`beta`)
9395

pwnlib/elf/elf.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -358,6 +358,7 @@ def __init__(self, path, checksec=True):
358358
self._populate_functions()
359359
self._populate_kernel_version()
360360

361+
self._print_checksec = checksec
361362
if checksec:
362363
self._describe()
363364

@@ -730,12 +731,13 @@ def libc(self):
730731
""":class:`.ELF`: If this :class:`.ELF` imports any libraries which contain ``'libc[.-]``,
731732
and we can determine the appropriate path to it on the local
732733
system, returns a new :class:`.ELF` object pertaining to that library.
734+
Prints the `checksec` output of the library if it was printed for the original ELF too.
733735
734736
If not found, the value will be :const:`None`.
735737
"""
736738
for lib in self.libs:
737739
if '/libc.' in lib or '/libc-' in lib:
738-
return ELF(lib)
740+
return ELF(lib, self._print_checksec)
739741

740742
def _populate_libraries(self):
741743
"""

0 commit comments

Comments
 (0)