Ejemplo n.º 1
0
 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
Ejemplo n.º 2
0
 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
Ejemplo n.º 3
0
 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
Ejemplo n.º 4
0
 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
Ejemplo n.º 5
0
 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
Ejemplo n.º 6
0
 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)
Ejemplo n.º 7
0
 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)
Ejemplo n.º 8
0
 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