MCPcopy Create free account
hub / github.com/HexHive/NASS / search_pattern

Method search_pattern

tools/gef.py:5797–5816  ·  view source on GitHub ↗

Search a pattern within the whole userland memory.

(self, pattern: str, section_name: str)

Source from the content-addressed store, hash-verified

5795 return locations
5796
5797 def search_pattern(self, pattern: str, section_name: str) -> None:
5798 """Search a pattern within the whole userland memory."""
5799 for section in gef.memory.maps:
5800 if not section.permission & Permission.READ: continue
5801 if section.path == "[vvar]": continue
5802 if not section_name in section.path: continue
5803
5804 start = section.page_start
5805 end = section.page_end - 1
5806 old_section = None
5807
5808 for loc in self.search_pattern_by_address(pattern, start, end):
5809 addr_loc_start = lookup_address(loc[0])
5810 if addr_loc_start and addr_loc_start.section:
5811 if old_section != addr_loc_start.section:
5812 self.print_section(addr_loc_start.section)
5813 old_section = addr_loc_start.section
5814
5815 self.print_loc(loc)
5816 return
5817
5818 @only_if_gdb_running
5819 def do_invoke(self, argv: List[str]) -> None:

Callers 1

do_invokeMethod · 0.95

Calls 4

print_sectionMethod · 0.95
print_locMethod · 0.95
lookup_addressFunction · 0.85

Tested by

no test coverage detected