def __init__(self, # type: ignore # (mypy doesn't like multiprocessing lib)
options: seproxer.mitmproxy_extensions.options,
server: mitmproxy.proxy.server,
results_queue: multiprocessing.Queue,
push_event: multiprocessing.Event,
active_flows_state: multiprocessing.Value,
) -> None:
"""
:param options: The extended mitmproxy options, used to configure our addons
:param server: The mitmproxy server that the proxy will be interfacing with
:param results_queue: The mitmproxy flows will be pushed into this queue
:param push_event: When this event is set, the stored flows will
be pushed into the `results_queue`
:param active_flows_state: A shared state that determines if there are any active flows,
that is, if any requests have pending responses
"""
super().__init__(options, server)
# This addon will allow us to modify headers, this is particularly useful for appending
# authentication cookies since selenium_extensions cannot modify HTTP ONLY cookies
self.addons.add(mitmproxy.addons.setheaders.SetHeaders())
# This add-on hooks into javascript window.onerror and all the console logging
# methods to log message into our defined "window.__seproxer_logs" object
self.addons.add(mitmproxy_extensions.addons.JSConsoleErrorInjection())
# This addon will be responsible for storing our requests / responses in memory
# and will allow us to push the results through out results_queue
self._memory_stream_addon = mitmproxy_extensions.addons.MemoryStream()
self.addons.add(self._memory_stream_addon)
self.results_queue = results_queue
self.push_event = push_event
self.active_flows_state = active_flows_state
评论列表
文章目录