示例#1
0
 def __init__(self, interfaces, channel, drone):
     BaseDronePlugin.__init__(self, interfaces, channel, drone,
                              'CapturePlugin.{0}'.format(channel))
     self.logutil.log('Initializing')
     # Select interface
     try:
         self.kb = self.interfaces[0]
         self.kb.set_channel(self.channel)
         self.kb.active = True
     except Exception as e:
         print("failed to use interface")
         self.status = False
     # Pipe from the tasker to the filter module, used to send pickled tasking dictionaries (simple DictManager)
     recv_pconn, recv_cconn = Pipe()
     task_pconn, self.task_cconn = Pipe()
     self.task_queue = JoinableQueue()
     # Start the filter up
     self.p_filt = FilterProcess(recv_pconn, self.task_queue,
                                 self.done_event, self.task_update_event,
                                 self.drone, self.name)
     self.p_filt.start()
     self.logutil.log('Launched FilterProcess ({0})'.format(
         self.p_filt.pid))
     self.childprocesses.append(self.p_filt)
     # Start the receiver up
     self.p_recv = SnifferProcess(recv_cconn, self.kb, self.done_event,
                                  self.drone, self.name)
     self.p_recv.start()
     self.logutil.log('Launched SnifferProcess: ({0})'.format(
         self.p_recv.pid))
     self.childprocesses.append(self.p_recv)
示例#2
0
    def setUp(self):
        from multiprocessing import Pipe, Event
        from cap_filter_process import FilterProcess

        recv_pconn, self.recv_cconn = Pipe()
        self.done_event = Event()

        self.p_filt = FilterProcess(recv_pconn, self.done_event)
        self.p_filt.start()