I have a question about mitmproxy (mitmdump).
What I need is to change mitmproxy configuration at runtime. I have some scripts, let's say:
scripts/
test-case-1.py
test-case-2.py
and I need to load (or unload) a proper script while mitmdump is running.
Unfortunaly, running mitmdump -s /scripts/test-case-1.py
returns
/scripts # mitmdump -s ./test-case-1.py
Error starting proxy server: OSError(98, 'Address in use')
Is it possible to somehow call the mitmdump to append a proper script?
Thanks for your support!
On Python level addons (and scripts usually contain Mitm addons) can be added and removed at run-time. But AFAIK in mitmdump there is no interface for doing so (not sure about mitmproxy/mitmweb).
One possibility would be to build a plugin based on the ASGI-Flask example addon. It provides a virtual host that can be accessed via Mitmproxy and if a certain path on that server like example.com/enableaddon1
you can enable or disable a second addon.
Alternatively you can simply change a global variable that makes your second add-on behave differently.
This requires a bit of Python programming but it gives you a lot flexibility.