MCPcopy Create free account
hub / github.com/ELMERIKH/PyinMemoryPE / get_section_by_rva

Method get_section_by_rva

pythonmemorymodule/pefile.py:6040–6054  ·  view source on GitHub ↗

Get the section containing the given address.

(self, rva)

Source from the content-addressed store, hash-verified

6038 return None
6039
6040 def get_section_by_rva(self, rva):
6041 """Get the section containing the given address."""
6042
6043 # if we look a lot of times at RVA in the same section, "cache" the last used section
6044 # to speedup lookups (very useful when parsing import table)
6045 if self._get_section_by_rva_last_used is not None:
6046 if self._get_section_by_rva_last_used.contains_rva(rva):
6047 return self._get_section_by_rva_last_used
6048
6049 for section in self.sections:
6050 if section.contains_rva(rva):
6051 self._get_section_by_rva_last_used = section
6052 return section
6053
6054 return None
6055
6056 def __str__(self):
6057 return self.dump_info()

Callers 6

__parse__Method · 0.95
get_dataMethod · 0.95
get_offset_from_rvaMethod · 0.95
get_string_at_rvaMethod · 0.95

Calls 1

contains_rvaMethod · 0.80

Tested by

no test coverage detected