How to use the mitmproxy.options.Options 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 / test / mitmproxy / tools / console / test_statusbar.py View on Github external
def test_statusbar(monkeypatch):
    o = options.Options()
    m = master.ConsoleMaster(o)
    m.options.update(
        setheaders=[":~q:foo:bar"],
        replacements=[":~q:foo:bar"],
        ignore_hosts=["example.com", "example.org"],
        tcp_hosts=["example.tcp"],
        intercept="~q",
        view_filter="~dst example.com",
        stickycookie="~dst example.com",
        stickyauth="~dst example.com",
        console_default_contentview="javascript",
        anticache=True,
        anticomp=True,
        showhost=True,
        server_replay_refresh=False,
        server_replay_kill_extra=True,
github mitmproxy / mitmproxy / test / mitmproxy / tservers.py View on Github external
def get_options(cls):
        cls.cadir = os.path.join(tempfile.gettempdir(), "mitmproxy")
        return options.Options(
            listen_port=0,
            cadir=cls.cadir,
            add_upstream_certs_to_client_chain=cls.add_upstream_certs_to_client_chain,
            ssl_insecure=True,
        )
github mitmproxy / mitmproxy / test / mitmproxy / tools / test_cmdline.py View on Github external
def test_mitmweb():
    opts = options.Options()
    web.master.WebMaster(opts)
    ap = cmdline.mitmweb(opts)
    assert ap
github mitmproxy / mitmproxy / test / mitmproxy / tools / test_dump.py View on Github external
def mkmaster(self, flt, **opts):
        o = options.Options(view_filter=flt, verbosity=-1, flow_detail=0, **opts)
        m = dump.DumpMaster(o, proxy.DummyServer(), with_termlog=False, with_dumper=False)
        return m
github mitmproxy / mitmproxy / test / mitmproxy / tools / console / test_statusbar.py View on Github external
def test_shorten_message(message, ready_message):
    o = options.Options()
    m = master.ConsoleMaster(o)
    ab = statusbar.ActionBar(m)
    assert ab.shorten_message(message, max_width=30) == ready_message
github mitmproxy / mitmproxy / test / mitmproxy / proxy / protocol / test_websocket.py View on Github external
def get_options(cls):
        opts = options.Options(
            listen_port=0,
            upstream_cert=True,
            ssl_insecure=True,
            websocket=True,
        )
        opts.confdir = os.path.join(tempfile.gettempdir(), "mitmproxy")
        return opts
github mitmproxy / mitmproxy / test / mitmproxy / test_optmanager.py View on Github external
def test_dump_dicts():
    o = options.Options()
    assert optmanager.dump_dicts(o)
    assert optmanager.dump_dicts(o, ['http2', 'listen_port'])
github BBVA / apicheck / _apicheck / apicheck / tools / proxy / run.py View on Github external
def run_mitm(
        master_cls: typing.Type[master.Master],
        make_parser: typing.Callable[[options.Options], argparse.ArgumentParser],
        arguments: typing.Sequence[str],
        extra: typing.Callable[[typing.Any], dict] = None
) -> master.Master:  # pragma: no cover
    """
        extra: Extra argument processing callable which returns a dict of
        options.
    """
    debug.register_info_dumpers()

    opts = options.Options()
    master = master_cls(opts)

    parser = make_parser(opts)

    # To make migration from 2.x to 3.0 bearable.
    if "-R" in sys.argv and sys.argv[sys.argv.index("-R") + 1].startswith("http"):
        print("-R is used for specifying replacements.\n"
              "To use mitmproxy in reverse mode please use --mode reverse:SPEC instead")

    try:
        args = parser.parse_args(arguments)
    except SystemExit:
        arg_check.check()
        sys.exit(1)
    try:
        opts.confdir = args.confdir