Ejemplo n.º 1
0
    def new_circuit(self, circ_event):
        """
        Invoke a new probing module when a new circuit becomes ready.
        """

        self.stats.update_circs(circ_event)
        self.check_finished()

        if circ_event.status not in [CircStatus.BUILT]:
            return

        last_hop = circ_event.path[-1]
        exit_fpr = last_hop[0]
        logger.debug("Circuit for exit relay \"%s\" is built.  "
                     "Now invoking probing module." % exit_fpr)

        run_cmd_over_tor = command.Command(self.queue, circ_event.id,
                                           socket.socket)

        exit_desc = get_relay_desc(self.controller, exit_fpr)
        if exit_desc is None:
            self.controller.close_circuit(circ_event.id)
            return

        module = module_closure(
            self.queue, self.module.probe, circ_event.id, exit_desc,
            command.run_python_over_tor(self.queue, circ_event.id,
                                        self.socks_port), run_cmd_over_tor)

        proc = multiprocessing.Process(target=module)
        proc.daemon = True
        proc.start()
Ejemplo n.º 2
0
    def new_circuit(self, circ_event):
        """
        Invoke a new probing module when a new circuit becomes ready.
        """

        self.stats.update_circs(circ_event)
        self.check_finished()

        if circ_event.status not in [CircStatus.BUILT]:
            return

        last_hop = circ_event.path[-1]
        exit_fpr = last_hop[0]
        logger.debug("Circuit for exit relay \"%s\" is built.  "
                     "Now invoking probing module." % exit_fpr)

        run_cmd_over_tor = command.Command(self.queue,
                                           circ_event.id,
                                           socket.socket)

        exit_desc = get_relay_desc(self.controller, exit_fpr)
        if exit_desc is None:
            self.controller.close_circuit(circ_event.id)
            return

        module = module_closure(self.queue, self.module.probe,
                                circ_event.id, exit_desc,
                                command.run_python_over_tor(self.queue,
                                                            circ_event.id,
                                                            self.socks_port),
                                run_cmd_over_tor)

        proc = multiprocessing.Process(target=module)
        proc.daemon = True
        proc.start()