Beispiel #1
0
 def handlecontext(self):
     # Handlecontexts also have to nest - leave cleanup to the outermost
     if mitmproxy_ctx.master:
         yield
         return
     mitmproxy_ctx.master = self
     mitmproxy_ctx.log = log.Log(self)
     try:
         yield
     finally:
         mitmproxy_ctx.master = None
         mitmproxy_ctx.log = None
Beispiel #2
0
    def __init__(self, opts):
        self.should_exit = threading.Event()
        self.event_loop = asyncio.get_event_loop()
        self.options: options.Options = opts or options.Options()
        self.commands = command.CommandManager(self)
        self.addons = addonmanager.AddonManager(self)
        self._server = None
        self.log = log.Log(self)

        mitmproxy_ctx.master = self
        mitmproxy_ctx.log = self.log
        mitmproxy_ctx.options = self.options
Beispiel #3
0
    def __init__(self, opts, event_loop: Optional[asyncio.AbstractEventLoop] = None):
        self.options: options.Options = opts or options.Options()
        self.commands = command.CommandManager(self)
        self.addons = addonmanager.AddonManager(self)
        self.log = log.Log(self)

        # We expect an active event loop here already because some addons
        # may want to spawn tasks during the initial configuration phase,
        # which happens before run().
        self.event_loop = event_loop or asyncio.get_running_loop()
        try:
            self.should_exit = asyncio.Event()
        except RuntimeError:
            self.should_exit = asyncio.Event(loop=self.event_loop)
        mitmproxy_ctx.master = self
        mitmproxy_ctx.log = self.log
        mitmproxy_ctx.options = self.options
Beispiel #4
0
    def __init__(self, opts):
        self.should_exit = threading.Event()
        self.channel = controller.Channel(
            self,
            asyncio.get_event_loop(),
            self.should_exit,
        )

        self.options: options.Options = opts or options.Options()
        self.commands = command.CommandManager(self)
        self.addons = addonmanager.AddonManager(self)
        self._server = None
        self.waiting_flows = []
        self.log = log.Log(self)

        mitmproxy_ctx.master = self
        mitmproxy_ctx.log = self.log
        mitmproxy_ctx.options = self.options