How to use the mitmproxy.command.command function in mitmproxy

To help you get started, we’ve selected a few mitmproxy examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github mitmproxy / mitmproxy / mitmproxy / tools / console / consoleaddons.py View on Github external
    @command.command("console.nav.up")
    def nav_up(self) -> None:
        """
            Go up.
        """
        self.master.inject_key("up")
github mitmproxy / mitmproxy / mitmproxy / tools / console / consoleaddons.py View on Github external
    @command.command("console.nav.next")
    def nav_next(self) -> None:
        """
            Go to the next navigatable item.
        """
        self.master.inject_key("m_next")
github mitmproxy / mitmproxy / mitmproxy / tools / console / consoleaddons.py View on Github external
    @command.command("console.grideditor.insert")
    def grideditor_insert(self) -> None:
        """
            Insert a row before the cursor.
        """
        self._grideditor().cmd_insert()
github mitmproxy / mitmproxy / mitmproxy / tools / console / consoleaddons.py View on Github external
    @command.command("console.grideditor.delete")
    def grideditor_delete(self) -> None:
        """
            Delete row
        """
        self._grideditor().cmd_delete()
github mitmproxy / mitmproxy / mitmproxy / tools / console / consoleaddons.py View on Github external
    @command.command("console.key.bind")
    def key_bind(
        self,
        contexts: typing.Sequence[str],
        key: str,
        cmd: mitmproxy.types.Cmd,
        *args: mitmproxy.types.Arg
    ) -> None:
        """
            Bind a shortcut key.
        """
        try:
            self.master.keymap.add(
                key,
                cmd + " " + " ".join(args),
                contexts,
                ""
github mitmproxy / mitmproxy / mitmproxy / addons / view.py View on Github external
    @command.command("view.focus.prev")
    def focus_prev(self) -> None:
        """
            Set focus to the previous flow.
        """
        if self.focus.index is not None:
            idx = self.focus.index - 1
            if self.inbounds(idx):
                self.focus.flow = self[idx]
        else:
            pass
github mitmproxy / mitmproxy / mitmproxy / addons / script.py View on Github external
    @command.command("script.run")
    def script_run(self, flows: typing.Sequence[flow.Flow], path: mtypes.Path) -> None:
        """
            Run a script on the specified flows. The script is configured with
            the current options and all lifecycle events for each flow are
            simulated. Note that the load event is not invoked.
        """
        if not os.path.isfile(path):
            ctx.log.error('No such script: %s' % path)
            return
        mod = load_script(path)
        if mod:
            with addonmanager.safecall():
                ctx.master.addons.invoke_addon(mod, "running")
                ctx.master.addons.invoke_addon(
                    mod,
                    "configure",
github mitmproxy / mitmproxy / mitmproxy / addons / view.py View on Github external
    @command.command("view.settings.setval")
    def setvalue(
        self,
        flows: typing.Sequence[mitmproxy.flow.Flow],
        key: str, value: str
    ) -> None:
        """
            Set a value in the settings store for the specified flows.
        """
        updated = []
        for f in flows:
            self.settings[f][key] = value
            updated.append(f)
        ctx.master.addons.trigger("update", updated)
github mitmproxy / mitmproxy / mitmproxy / addons / serverplayback.py View on Github external
    @command.command("replay.server.stop")
    def clear(self) -> None:
        """
            Stop server replay.
        """
        self.flowmap = {}
        ctx.master.addons.trigger("update", [])
github mitmproxy / mitmproxy / mitmproxy / addons / core.py View on Github external
    @command.command("flow.encode.options")
    def encode_options(self) -> typing.Sequence[str]:
        """
            The possible values for an encoding specification.
        """
        return ["gzip", "deflate", "br", "zstd"]