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

Method disable_all_memory_breakpoints

windows/debug/debugger.py:981–1005  ·  view source on GitHub ↗

Restore all pages to their original access rights. If target is ``None``, use ``current_process`` :return: a mapping of all disabled breakpoints that must be passed to :func:`restore_all_memory_breakpoints`

(self, target=None)

Source from the content-addressed store, hash-verified

979 return None
980
981 def disable_all_memory_breakpoints(self, target=None):
982 """Restore all pages to their original access rights.
983 If target is ``None``, use ``current_process``
984
985 :return: a mapping of all disabled breakpoints that must be passed to :func:`restore_all_memory_breakpoints`"""
986 if target is None:
987 target = self.current_process
988 res = {}
989 cp_watch_page = self._watched_pages[target.pid]
990 page_protection = DWORD()
991 for page_addr, watched_page in cp_watch_page.items():
992 try:
993 target.virtual_protect(page_addr, PAGE_SIZE, watched_page.original_prot, page_protection)
994 except WindowsError as e:
995 # Check if page have been unmapped
996 # print("disable_all_memory_breakpoints failed on page {0:#x} in state {1:#x}".format(page_addr, target.query_memory(page_addr).State))
997 # if not target.query_memory(page_addr).State == MEM_FREE:
998 # import pdb;pdb.set_trace()
999 # raise
1000 # If page have been unmap, warn the concerned Breakpoints.
1001 for bp in watched_page.bps:
1002 # TODO: Document
1003 bp.on_error(self, page_addr)
1004 res[page_addr] = page_protection.value
1005 return res
1006
1007
1008 def restore_all_memory_breakpoints(self, data, target=None):

Callers 2

detachMethod · 0.95

Calls 2

virtual_protectMethod · 0.80
itemsMethod · 0.45

Tested by

no test coverage detected