def make_mappings(self):
     """Connect the debugguer to the process and gets the memory mappings
     metadata."""
     self.dbg = dbg.get_debugger(self._pid)
     self._memory_handler = make_process_memory_handler(self.dbg.get_process())
     log.debug('Memory Mappings read. Dropping ptrace on pid.')
     return
 def make_mappings(self):
     """Connect the debugguer to the process and gets the memory mappings
     metadata."""
     self.dbg = dbg.get_debugger(self._pid)
     self._memory_handler = make_process_memory_handler(self.dbg.get_process())
     log.debug('Memory Mappings read. Dropping ptrace on pid.')
     return
Beispiel #3
0
def make_local_process_memory_handler(pid, use_mmap=True):
    if not isinstance(pid, (int, long)):
        raise TypeError('PID should be a number')
    from haystack.mappings import process
    my_debugger = get_debugger(pid)
    _memory_handler = process.make_process_memory_handler(my_debugger.get_process())
    t0 = time.time()
    for m in _memory_handler:
        if use_mmap:
            # force to mmap the memory in local space
            m.mmap()
            log.debug('mmap() size:%d', len(m.mmap()))
    if use_mmap:
        # mmap done, we can release process...
        my_debugger.get_process().resume()
        log.info('MemoryHandler mmaped, process released after %02.02f secs', time.time() - t0)
    return _memory_handler
Beispiel #4
0
def make_local_process_memory_handler(pid, use_mmap=True):
    if not isinstance(pid, (int, long)):
        raise TypeError('PID should be a number')
    from haystack.mappings import process
    my_debugger = get_debugger(pid)
    _memory_handler = process.make_process_memory_handler(
        my_debugger.get_process())
    t0 = time.time()
    for m in _memory_handler:
        if use_mmap:
            # force to mmap the memory in local space
            m.mmap()
            log.debug('mmap() size:%d', len(m.mmap()))
    if use_mmap:
        # mmap done, we can release process...
        my_debugger.get_process().resume()
        log.info('MemoryHandler mmaped, process released after %02.02f secs',
                 time.time() - t0)
    return _memory_handler
Beispiel #5
0
def getMappings():
    me = Dummy()
    me.pid = os.getpid()
    return make_process_memory_handler(me)