#!/usr/bin/env python3 import asyncio from mitmproxy import options, optmanager from mitmproxy.tools import dump, console, web masters = { "mitmproxy": console.master.ConsoleMaster, "mitmdump": dump.DumpMaster, "mitmweb": web.master.WebMaster } unified_options = {} async def dump(): for tool_name, master in masters.items(): opts = options.Options() _ = master(opts) for key, option in optmanager.dump_dicts(opts).items(): if key in unified_options: unified_options[key]['tools'].append(tool_name) else: unified_options[key] = option unified_options[key]['tools'] = [tool_name] asyncio.run(dump()) print(""" """.strip()) for key, option in sorted(unified_options.items(), key=lambda t: t[0]): print(f""" """.strip()) print("
Name Type Description
#   {key}
{' '.join(["{}".format(t) for t in option['tools']])}
{option['type']} {option['help']}
Default: {option['default']} {"
Choices: {}".format(', '.join(option['choices'])) if option['choices'] else ""}
")