Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@ The table below shows which release corresponds to each branch, and what date th
- [#2596][2596] Ignore `colored_traceback` error when TERM envvar is unset
- [#2579][2579] Fix poll error in `process.libs()` and clean up maps parsing
- [#2602][2602] Allow setting debugger path via context.gdb_binary
- [#2606][2606] Fix `process.maps()`

[2545]: https://github.com/Gallopsled/pwntools/pull/2545
[2567]: https://github.com/Gallopsled/pwntools/pull/2567
Expand All @@ -160,6 +161,7 @@ The table below shows which release corresponds to each branch, and what date th
[2596]: https://github.com/Gallopsled/pwntools/pull/2596
[2579]: https://github.com/Gallopsled/pwntools/pull/2579
[2602]: https://github.com/Gallopsled/pwntools/pull/2602
[2606]: https://github.com/Gallopsled/pwntools/pull/2606

## 4.14.1 (`stable`)

Expand Down
15 changes: 6 additions & 9 deletions pwnlib/tubes/process.py
Original file line number Diff line number Diff line change
Expand Up @@ -944,7 +944,10 @@ def maps(self):
# addr = address (alias) = start (alias)

from pwnlib.util.proc import memory_maps
raw_maps = memory_maps(self.pid)
raw_maps = self.poll() is None and memory_maps(self.pid)

if not raw_maps:
raise RuntimeError("Could not read maps, process %s has finished" % self.pid)

maps = []
# raw_mapping
Expand Down Expand Up @@ -1322,17 +1325,11 @@ def libs(self):
by the process to the address it is loaded at in the process' address
space.
"""
maps_raw = self.poll() is None and self.maps()

if not maps_raw:
import pwnlib.elf.elf

with context.quiet:
return pwnlib.elf.elf.ELF(self.executable).maps
all_maps = self.maps()

# Enumerate all of the libraries actually loaded right now.
libs = {}
for mapping in maps_raw:
for mapping in all_maps:
path = mapping.path
if os.sep not in path: continue
path = os.path.realpath(path)
Expand Down
Loading