def run_once(self, command, flows): sc = Script(command) sc.load_script() for f in flows: for evt, o in events.event_sequence(f): sc.run(evt, o) sc.done() return sc
def run_once(self, command, flows): try: sc = Script(command) except ValueError as e: raise ValueError(str(e)) sc.load_script() for f in flows: for evt, o in events.event_sequence(f): sc.run(evt, o) sc.done() return sc
def cycle(self, addon, f): """ Cycles the flow through the events for the flow. Stops if a reply is taken (as in flow interception). """ f.reply._state = "handled" for evt, arg in events.event_sequence(f): h = getattr(addon, evt, None) if h: h(arg) if f.reply.state == "taken": return
def load_flow(self, f): """ Loads a flow """ if isinstance(f, http.HTTPFlow): if self.server and self.options.mode == "reverse": f.request.host = self.server.config.upstream_server.address.host f.request.port = self.server.config.upstream_server.address.port f.request.scheme = self.server.config.upstream_server.scheme f.reply = controller.DummyReply() for e, o in events.event_sequence(f): getattr(self, e)(o)