2018-03-25 10:12:00 +00:00
|
|
|
#!/usr/bin/env python3
|
2022-03-15 18:02:43 +00:00
|
|
|
import asyncio
|
2018-03-25 10:12:00 +00:00
|
|
|
|
2022-11-29 13:28:41 +00:00
|
|
|
from mitmproxy import options
|
|
|
|
from mitmproxy import optmanager
|
|
|
|
from mitmproxy.tools import console
|
|
|
|
from mitmproxy.tools import dump
|
|
|
|
from mitmproxy.tools import web
|
2018-03-24 22:14:58 +00:00
|
|
|
|
|
|
|
masters = {
|
|
|
|
"mitmproxy": console.master.ConsoleMaster,
|
|
|
|
"mitmdump": dump.DumpMaster,
|
2022-04-26 11:53:35 +00:00
|
|
|
"mitmweb": web.master.WebMaster,
|
2018-03-24 22:14:58 +00:00
|
|
|
}
|
|
|
|
|
2018-03-25 10:12:00 +00:00
|
|
|
unified_options = {}
|
|
|
|
|
2022-03-15 18:02:43 +00:00
|
|
|
|
|
|
|
async def dump():
|
|
|
|
for tool_name, master in masters.items():
|
|
|
|
opts = options.Options()
|
2022-03-15 18:06:34 +00:00
|
|
|
_ = master(opts)
|
2022-03-15 18:02:43 +00:00
|
|
|
for key, option in optmanager.dump_dicts(opts).items():
|
|
|
|
if key in unified_options:
|
2022-04-26 11:53:35 +00:00
|
|
|
unified_options[key]["tools"].append(tool_name)
|
2022-03-15 18:02:43 +00:00
|
|
|
else:
|
|
|
|
unified_options[key] = option
|
2022-04-26 11:53:35 +00:00
|
|
|
unified_options[key]["tools"] = [tool_name]
|
2022-03-15 18:02:43 +00:00
|
|
|
|
|
|
|
|
|
|
|
asyncio.run(dump())
|
2018-03-25 10:12:00 +00:00
|
|
|
|
2022-04-26 11:53:35 +00:00
|
|
|
print(
|
|
|
|
"""
|
2018-03-25 10:12:00 +00:00
|
|
|
<table class=\"table optiontable\">
|
|
|
|
<thead>
|
|
|
|
<tr>
|
|
|
|
<th>Name</th>
|
|
|
|
<th>Type</th>
|
|
|
|
<th>Description</th>
|
|
|
|
</tr>
|
|
|
|
</thead>
|
|
|
|
<tbody>
|
2022-04-26 11:53:35 +00:00
|
|
|
""".strip()
|
|
|
|
)
|
2018-03-25 10:12:00 +00:00
|
|
|
for key, option in sorted(unified_options.items(), key=lambda t: t[0]):
|
2022-04-26 11:53:35 +00:00
|
|
|
print(
|
|
|
|
f"""
|
2022-03-15 18:02:43 +00:00
|
|
|
<tr id="{key}">
|
|
|
|
<th>
|
|
|
|
<a class="anchor" href="#{key}"># </a>
|
|
|
|
{key}<br/>
|
|
|
|
{' '.join(["<span class='badge'>{}</span>".format(t) for t in option['tools']])}</th>
|
|
|
|
<td>{option['type']}</td>
|
|
|
|
<td>{option['help']}<br/>
|
|
|
|
Default: {option['default']}
|
|
|
|
{"<br/>Choices: {}".format(', '.join(option['choices'])) if option['choices'] else ""}
|
2018-03-25 10:12:00 +00:00
|
|
|
</td>
|
|
|
|
</tr>
|
2022-04-26 11:53:35 +00:00
|
|
|
""".strip()
|
|
|
|
)
|
2018-03-25 10:12:00 +00:00
|
|
|
print("</tbody></table>")
|