diff options
Diffstat (limited to 'mitmproxy/options.py')
-rw-r--r-- | mitmproxy/options.py | 212 |
1 files changed, 11 insertions, 201 deletions
diff --git a/mitmproxy/options.py b/mitmproxy/options.py index 76060548..70d454fd 100644 --- a/mitmproxy/options.py +++ b/mitmproxy/options.py @@ -12,8 +12,6 @@ log_verbosity = [ "debug", ] -APP_HOST = "mitm.it" -APP_PORT = 80 CA_DIR = "~/.mitmproxy" LISTEN_PORT = 8080 @@ -30,202 +28,55 @@ class Options(optmanager.OptManager): # This provides type hints for IDEs (e.g. PyCharm) and mypy. # Autogenerated using test/helper_tools/typehints_for_options.py add_upstream_certs_to_client_chain = None # type: bool - allow_remote = None # type: bool - anticache = None # type: bool - anticomp = None # type: bool body_size_limit = None # type: Optional[str] cadir = None # type: str certs = None # type: Sequence[str] ciphers_client = None # type: Optional[str] ciphers_server = None # type: Optional[str] client_certs = None # type: Optional[str] - client_replay = None # type: Sequence[str] - console_focus_follow = None # type: bool - console_layout = None # type: str - console_layout_headers = None # type: bool - console_mouse = None # type: bool - console_palette = None # type: str - console_palette_transparent = None # type: bool - default_contentview = None # type: str - flow_detail = None # type: int http2 = None # type: bool http2_priority = None # type: bool ignore_hosts = None # type: Sequence[str] - intercept = None # type: Optional[str] - intercept_active = None # type: bool keep_host_header = None # type: bool - keepserving = None # type: bool listen_host = None # type: str listen_port = None # type: int mode = None # type: str - onboarding = None # type: bool - onboarding_host = None # type: str - onboarding_port = None # type: int - proxyauth = None # type: Optional[str] rawtcp = None # type: bool - server_replay_refresh = None # type: bool - replacements = None # type: Sequence[str] - server_replay_kill_extra = None # type: bool - rfile = None # type: Optional[str] - save_stream_file = None # type: Optional[str] - save_stream_filter = None # type: Optional[str] - scripts = None # type: Sequence[str] server = None # type: bool - server_replay = None # type: Sequence[str] - server_replay_ignore_content = None # type: bool - server_replay_ignore_host = None # type: bool - server_replay_ignore_params = None # type: Sequence[str] - server_replay_ignore_payload_params = None # type: Sequence[str] - server_replay_nopop = None # type: bool - server_replay_use_headers = None # type: Sequence[str] - setheaders = None # type: Sequence[str] - showhost = None # type: bool spoof_source_address = None # type: bool ssl_insecure = None # type: bool ssl_verify_upstream_trusted_ca = None # type: Optional[str] ssl_verify_upstream_trusted_cadir = None # type: Optional[str] ssl_version_client = None # type: str ssl_version_server = None # type: str - stickyauth = None # type: Optional[str] - stickycookie = None # type: Optional[str] - stream_large_bodies = None # type: Optional[str] - stream_websockets = None # type: bool tcp_hosts = None # type: Sequence[str] - upstream_auth = None # type: Optional[str] upstream_bind_address = None # type: str upstream_cert = None # type: bool + websocket = None # type: bool + + # FIXME: Options that must be migrated to addons, but are complicated + # because they're used by more than one addon, or because they're + # embedded in the core code somehow. + default_contentview = None # type: str + flow_detail = None # type: int + intercept = None # type: Optional[str] + intercept_active = None # type: bool + proxyauth = None # type: Optional[str] + showhost = None # type: bool verbosity = None # type: str view_filter = None # type: Optional[str] - view_order = None # type: str - view_order_reversed = None # type: bool - web_debug = None # type: bool - web_iface = None # type: str - web_open_browser = None # type: bool - web_port = None # type: int - websocket = None # type: bool def __init__(self, **kwargs) -> None: super().__init__() self.add_option( - "onboarding", bool, True, - "Toggle the mitmproxy onboarding app." - ) - self.add_option( - "onboarding_host", str, APP_HOST, - """ - Onboarding app domain. For transparent mode, use an IP when a DNS - entry for the app domain is not present. - """ - ) - self.add_option( - "onboarding_port", int, APP_PORT, - "Port to serve the onboarding app from." - ) - self.add_option( - "anticache", bool, False, - """ - Strip out request headers that might cause the server to return - 304-not-modified. - """ - ) - self.add_option( - "anticomp", bool, False, - "Try to convince servers to send us un-compressed data." - ) - self.add_option( - "client_replay", Sequence[str], [], - "Replay client requests from a saved file." - ) - self.add_option( - "server_replay_kill_extra", bool, False, - "Kill extra requests during replay." - ) - self.add_option( - "keepserving", bool, False, - """ - Continue serving after client playback, server playback or file - read. This option is ignored by interactive tools, which always keep - serving. - """ - ) - self.add_option( "server", bool, True, "Start a proxy server. Enabled by default." ) self.add_option( - "server_replay_nopop", bool, False, - """ - Don't remove flows from server replay state after use. This makes it - possible to replay same response multiple times. - """ - ) - self.add_option( - "server_replay_refresh", bool, True, - """ - Refresh server replay responses by adjusting date, expires and - last-modified headers, as well as adjusting cookie expiration. - """ - ) - self.add_option( - "rfile", Optional[str], None, - "Read flows from file." - ) - self.add_option( - "scripts", Sequence[str], [], - """ - Execute a script. - """ - ) - self.add_option( "showhost", bool, False, "Use the Host header to construct URLs for display." ) self.add_option( - "replacements", Sequence[str], [], - """ - Replacement patterns of the form "/pattern/regex/replacement", where - the separator can be any character. - """ - ) - self.add_option( - "server_replay_use_headers", Sequence[str], [], - "Request headers to be considered during replay." - ) - self.add_option( - "setheaders", Sequence[str], [], - """ - Header set pattern of the form "/pattern/header/value", where the - separator can be any character. - """ - ) - self.add_option( - "server_replay", Sequence[str], [], - "Replay server responses from a saved file." - ) - self.add_option( - "stickycookie", Optional[str], None, - "Set sticky cookie filter. Matched against requests." - ) - self.add_option( - "stickyauth", Optional[str], None, - "Set sticky auth filter. Matched against requests." - ) - self.add_option( - "stream_large_bodies", Optional[str], None, - """ - Stream data to the client if response body exceeds the given - threshold. If streamed, the body will not be stored in any way. - Understands k/m/g suffixes, i.e. 3m for 3 megabytes. - """ - ) - self.add_option( - "stream_websockets", bool, False, - """ - Stream WebSocket messages between client and server. - Messages are captured and cannot be modified. - """ - ) - self.add_option( "verbosity", str, 'info', "Log verbosity.", choices=log_verbosity @@ -235,40 +86,6 @@ class Options(optmanager.OptManager): "The default content view mode.", choices = [i.name.lower() for i in contentviews.views] ) - self.add_option( - "save_stream_file", Optional[str], None, - "Stream flows to file as they arrive. Prefix path with + to append." - ) - self.add_option( - "save_stream_filter", Optional[str], None, - "Filter which flows are written to file." - ) - self.add_option( - "server_replay_ignore_content", bool, False, - "Ignore request's content while searching for a saved flow to replay." - ) - self.add_option( - "server_replay_ignore_params", Sequence[str], [], - """ - Request's parameters to be ignored while searching for a saved flow - to replay. - """ - ) - self.add_option( - "server_replay_ignore_payload_params", Sequence[str], [], - """ - Request's payload parameters (application/x-www-form-urlencoded or - multipart/form-data) to be ignored while searching for a saved flow - to replay. - """ - ) - self.add_option( - "server_replay_ignore_host", bool, False, - """ - Ignore request's destination host while searching for a saved flow - to replay. - """ - ) # Proxy options self.add_option( @@ -396,13 +213,6 @@ class Options(optmanager.OptManager): """ ) self.add_option( - "upstream_auth", Optional[str], None, - """ - Add HTTP Basic authentication to upstream proxy and reverse proxy - requests. Format: username:password. - """ - ) - self.add_option( "ssl_version_client", str, "secure", """ Set supported SSL/TLS versions for client connections. SSLv2, SSLv3 |