Beispiel #1
0
 def __init__(self, *args, **kwds):
     # initialize table of system call rules
     self.sc_table = [self._KILL_RF, ] * 1024
     for scno in MiniSandbox.sc_safe[self.machine]:
         self.sc_table[scno] = self._CONT
     # initialize as a polymorphic sandbox-and-policy object
     SandboxPolicy.__init__(self)
     Sandbox.__init__(self, *args, **kwds)
     self.policy = self
Beispiel #2
0
 def __call__(self, e, a):
     # handle SYSCALL/SYSRET events with local rules
     if e.type in (S_EVENT_SYSCALL, S_EVENT_SYSRET):
         if machine == 'x86_64' and e.ext0 != 0:
             return self._KILL_RF(e, a)
         return self.sc_table[e.data](e, a)
     # bypass other events to base class
     return SandboxPolicy.__call__(self, e, a)
Beispiel #3
0
    def __call__(self, e, a):
        # handle SYSCALL/SYSRET events with local handlers
        if e.type in (S_EVENT_SYSCALL, S_EVENT_SYSRET):
            if MACHINE is 'x86_64' and e.ext0 is not 0:
                a.type, a.data = S_ACTION_KILL, S_RESULT_RF
                return a

            if e.type is 4 and e.data not in self.sc_safe[MACHINE]:
                self.sc_table[e.data] = self.sc_table.get(e.data, 0) + 1

            a.type = S_ACTION_CONT
            return a
        # bypass other events to base class
        return SandboxPolicy.__call__(self, e, a)
Beispiel #4
0
 def __init__(self, *args, **kwds):
     # initialize as a polymorphic sandbox-and-policy object
     kwds['policy'] = self
     SandboxPolicy.__init__(self)
     Sandbox.__init__(self, *args, **kwds)