2018-02-20 16:14:21 +00:00
|
|
|
"""
|
|
|
|
This example shows how addons can register custom options
|
|
|
|
that can be configured at startup or during execution
|
|
|
|
from the options dialog within mitmproxy.
|
|
|
|
|
|
|
|
Example:
|
|
|
|
|
|
|
|
$ mitmproxy --set custom=true
|
|
|
|
$ mitmproxy --set custom # shorthand for boolean options
|
|
|
|
"""
|
2017-03-09 00:52:58 +00:00
|
|
|
from mitmproxy import ctx
|
|
|
|
|
|
|
|
|
2017-03-23 22:29:36 +00:00
|
|
|
def load(l):
|
2017-03-09 00:52:58 +00:00
|
|
|
ctx.log.info("Registering option 'custom'")
|
2017-03-23 22:29:36 +00:00
|
|
|
l.add_option("custom", bool, False, "A custom option")
|
2017-03-09 00:52:58 +00:00
|
|
|
|
|
|
|
|
2017-04-25 23:01:27 +00:00
|
|
|
def configure(updated):
|
2017-03-13 20:22:44 +00:00
|
|
|
if "custom" in updated:
|
2017-04-25 23:01:27 +00:00
|
|
|
ctx.log.info("custom option value: %s" % ctx.options.custom)
|