コード例 #1
0
    def callafter(self, pid, call, result, state):
        # XXX: this needs work -- can't we just map on the way out of the
        # first execve or fork/vfork/clone, as appropriate?
        # NB: we don't want to map for the CLONE_VM case, since the map will
        # already be there (?)
        # How does CLONE_FILES and CLONE_FS affect this?

	if call != 'execve':
            if not _mapped.has_key(pid):
                # print 'Scratch: Deciding to poison ', pid, 's address space'
                _mapped[pid] = 1
                r = p_linux_i386.force_syscall(pid,
                                               syscallmap.lookup_number('mmap2'),
                                               scratch.base(),
                                               scratch.safe_len(),
                                               1, # PROT_READ
                                               0x12, # PRIVATE | FIXED
                                               123, 0)
                assert r == scratch.base(), "mmap failed (%s)" % r

	if call == 'execve':
#	    print 'Scratch: execve -- forgetting on pid', pid
	    try:
	        del _mapped[pid]
	    except:
	        print '%d did execve but I had not him mapped?' % pid
コード例 #2
0
ファイル: ScratchTrick.py プロジェクト: redwrasse/subterfugue
    def callafter(self, pid, call, result, state):
        # XXX: this needs work -- can't we just map on the way out of the
        # first execve or fork/vfork/clone, as appropriate?
        # NB: we don't want to map for the CLONE_VM case, since the map will
        # already be there (?)
        # How does CLONE_FILES and CLONE_FS affect this?

        if call != 'execve':
            if not _mapped.has_key(pid):
                # print 'Scratch: Deciding to poison ', pid, 's address space'
                _mapped[pid] = 1
                r = p_linux_i386.force_syscall(
                    pid,
                    syscallmap.lookup_number('mmap2'),
                    scratch.base(),
                    scratch.safe_len(),
                    1,  # PROT_READ
                    0x12,  # PRIVATE | FIXED
                    123,
                    0)
                assert r == scratch.base(), "mmap failed (%s)" % r

        if call == 'execve':
            #	    print 'Scratch: execve -- forgetting on pid', pid
            try:
                del _mapped[pid]
            except:
                print '%d did execve but I had not him mapped?' % pid
コード例 #3
0
    def __init__(self, options):
	self.start = options.get('start', scratch.base())
	self.end   = options.get('end',   scratch.base() + scratch.safe_len())
コード例 #4
0
 def __init__(self, options):
     self.start = options.get('start', scratch.base())
     self.end = options.get('end', scratch.base() + scratch.safe_len())