Skip to content

Commit

Permalink
add address_mapping()
Browse files Browse the repository at this point in the history
  • Loading branch information
k4lizen committed Mar 21, 2024
1 parent 898c733 commit 245f34a
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion pwnlib/tubes/process.py
Original file line number Diff line number Diff line change
Expand Up @@ -1112,7 +1112,7 @@ def get_mapping_location(self, path_value):
valid values are also [stack], [heap], etc..
Returns a mapping_location object if found some matching
mapping, which are contiguous in memory. Otherwise returns
mappings, which are contiguous in memory. Otherwise returns
None.
mapping_location:
Expand Down Expand Up @@ -1188,6 +1188,18 @@ def musl_location(self):
"""
return self._location_from_mappings(self.musl_mapping(False))

def address_mapping(self, address):
"""address_mapping(address) -> mapping
Returns mapping at the specified address.
"""

all_maps = self.maps()
for mapping in all_maps:
if mapping.addr <= address <= mapping.end:
return mapping
return None

def libs(self):
"""libs() -> dict
Expand Down

0 comments on commit 245f34a

Please sign in to comment.