repo
stringlengths
7
90
file_url
stringlengths
81
315
file_path
stringlengths
4
228
content
stringlengths
0
32.8k
language
stringclasses
1 value
license
stringclasses
7 values
commit_sha
stringlengths
40
40
retrieved_at
stringdate
2026-01-04 14:38:15
2026-01-05 02:33:18
truncated
bool
2 classes
mitmproxy/mitmproxy
https://github.com/mitmproxy/mitmproxy/blob/e6aa924bb411a9687b91920b8d094af37bc02b90/examples/contrib/sslstrip.py
examples/contrib/sslstrip.py
""" This script implements an sslstrip-like attack based on mitmproxy. https://moxie.org/software/sslstrip/ """ import re import urllib.parse from mitmproxy import http # set of SSL/TLS capable hosts secure_hosts: set[str] = set() def request(flow: http.HTTPFlow) -> None: flow.request.headers.pop("If-Modified-...
python
MIT
e6aa924bb411a9687b91920b8d094af37bc02b90
2026-01-04T14:40:00.086164Z
false
mitmproxy/mitmproxy
https://github.com/mitmproxy/mitmproxy/blob/e6aa924bb411a9687b91920b8d094af37bc02b90/examples/contrib/upstream_pac.py
examples/contrib/upstream_pac.py
""" Mitmproxy add-on to support using a PAC file to determine the upstream proxy to use. Supports adding an alternate proxy to use for when the PAC decides the connection should be DIRECT. Adds two options to mitmproxy: pac_url - an url that will return a pac file to use for evaluating which upstream proxy to use. dir...
python
MIT
e6aa924bb411a9687b91920b8d094af37bc02b90
2026-01-04T14:40:00.086164Z
false
mitmproxy/mitmproxy
https://github.com/mitmproxy/mitmproxy/blob/e6aa924bb411a9687b91920b8d094af37bc02b90/examples/contrib/save_streamed_data.py
examples/contrib/save_streamed_data.py
""" Save streamed requests and responses If the option 'save_streamed_data' is set to a format string then streamed requests and responses are written to individual files with a name derived from the string. Apart from python strftime() formating (using the request start time) the following codes can also be used: ...
python
MIT
e6aa924bb411a9687b91920b8d094af37bc02b90
2026-01-04T14:40:00.086164Z
false
mitmproxy/mitmproxy
https://github.com/mitmproxy/mitmproxy/blob/e6aa924bb411a9687b91920b8d094af37bc02b90/examples/contrib/domain_fronting.py
examples/contrib/domain_fronting.py
import json from dataclasses import dataclass from mitmproxy import ctx from mitmproxy.addonmanager import Loader from mitmproxy.http import HTTPFlow """ This extension implements support for domain fronting. Usage: mitmproxy -s examples/contrib/domain_fronting.py --set domainfrontingfile=./domain_fronting.json ...
python
MIT
e6aa924bb411a9687b91920b8d094af37bc02b90
2026-01-04T14:40:00.086164Z
false
mitmproxy/mitmproxy
https://github.com/mitmproxy/mitmproxy/blob/e6aa924bb411a9687b91920b8d094af37bc02b90/examples/contrib/mitmproxywrapper.py
examples/contrib/mitmproxywrapper.py
#!/usr/bin/env python # # Helper tool to enable/disable OS X proxy and wrap mitmproxy # # Get usage information with: # # mitmproxywrapper.py -h # import argparse import contextlib import os import re import signal import socketserver import subprocess import sys class Wrapper: def __init__(self, port, use_mitmwe...
python
MIT
e6aa924bb411a9687b91920b8d094af37bc02b90
2026-01-04T14:40:00.086164Z
false
mitmproxy/mitmproxy
https://github.com/mitmproxy/mitmproxy/blob/e6aa924bb411a9687b91920b8d094af37bc02b90/examples/contrib/webscanner_helper/proxyauth_selenium.py
examples/contrib/webscanner_helper/proxyauth_selenium.py
import abc import logging import random import string import time from typing import Any from typing import cast from selenium import webdriver import mitmproxy.http from mitmproxy import flowfilter from mitmproxy import master from mitmproxy.script import concurrent logger = logging.getLogger(__name__) cookie_key_...
python
MIT
e6aa924bb411a9687b91920b8d094af37bc02b90
2026-01-04T14:40:00.086164Z
false
mitmproxy/mitmproxy
https://github.com/mitmproxy/mitmproxy/blob/e6aa924bb411a9687b91920b8d094af37bc02b90/examples/contrib/webscanner_helper/watchdog.py
examples/contrib/webscanner_helper/watchdog.py
import logging import pathlib import time from datetime import datetime import mitmproxy.connections import mitmproxy.http from mitmproxy.addons.export import curl_command from mitmproxy.addons.export import raw from mitmproxy.exceptions import HttpSyntaxException logger = logging.getLogger(__name__) class Watchdog...
python
MIT
e6aa924bb411a9687b91920b8d094af37bc02b90
2026-01-04T14:40:00.086164Z
false
mitmproxy/mitmproxy
https://github.com/mitmproxy/mitmproxy/blob/e6aa924bb411a9687b91920b8d094af37bc02b90/examples/contrib/webscanner_helper/mapping.py
examples/contrib/webscanner_helper/mapping.py
import copy import logging from bs4 import BeautifulSoup from examples.contrib.webscanner_helper.urldict import URLDict from mitmproxy.http import HTTPFlow NO_CONTENT = object() class MappingAddonConfig: HTML_PARSER = "html.parser" class MappingAddon: """The mapping add-on can be used in combination with...
python
MIT
e6aa924bb411a9687b91920b8d094af37bc02b90
2026-01-04T14:40:00.086164Z
false
mitmproxy/mitmproxy
https://github.com/mitmproxy/mitmproxy/blob/e6aa924bb411a9687b91920b8d094af37bc02b90/examples/contrib/webscanner_helper/urlinjection.py
examples/contrib/webscanner_helper/urlinjection.py
import abc import html import json import logging from mitmproxy import flowfilter from mitmproxy.http import HTTPFlow logger = logging.getLogger(__name__) class InjectionGenerator: """Abstract class for an generator of the injection content in order to inject the URL index.""" ENCODING = "UTF8" @abc....
python
MIT
e6aa924bb411a9687b91920b8d094af37bc02b90
2026-01-04T14:40:00.086164Z
false
mitmproxy/mitmproxy
https://github.com/mitmproxy/mitmproxy/blob/e6aa924bb411a9687b91920b8d094af37bc02b90/examples/contrib/webscanner_helper/test_urldict.py
examples/contrib/webscanner_helper/test_urldict.py
from examples.contrib.webscanner_helper.urldict import URLDict from mitmproxy.test import tflow from mitmproxy.test import tutils url = "http://10.10.10.10" new_content_body = "New Body" new_content_title = "New Title" content = f'{{"body": "{new_content_body}", "title": "{new_content_title}"}}' url_error = "i~nvalid"...
python
MIT
e6aa924bb411a9687b91920b8d094af37bc02b90
2026-01-04T14:40:00.086164Z
false
mitmproxy/mitmproxy
https://github.com/mitmproxy/mitmproxy/blob/e6aa924bb411a9687b91920b8d094af37bc02b90/examples/contrib/webscanner_helper/test_mapping.py
examples/contrib/webscanner_helper/test_mapping.py
from collections.abc import Callable from typing import TextIO from unittest import mock from unittest.mock import MagicMock from examples.contrib.webscanner_helper.mapping import MappingAddon from examples.contrib.webscanner_helper.mapping import MappingAddonConfig from mitmproxy.test import tflow from mitmproxy.test...
python
MIT
e6aa924bb411a9687b91920b8d094af37bc02b90
2026-01-04T14:40:00.086164Z
false
mitmproxy/mitmproxy
https://github.com/mitmproxy/mitmproxy/blob/e6aa924bb411a9687b91920b8d094af37bc02b90/examples/contrib/webscanner_helper/urlindex.py
examples/contrib/webscanner_helper/urlindex.py
import abc import datetime import json import logging from pathlib import Path from mitmproxy import flowfilter from mitmproxy.http import HTTPFlow logger = logging.getLogger(__name__) class UrlIndexWriter(abc.ABC): """Abstract Add-on to write seen URLs. For example, these URLs can be injected in a web app...
python
MIT
e6aa924bb411a9687b91920b8d094af37bc02b90
2026-01-04T14:40:00.086164Z
false
mitmproxy/mitmproxy
https://github.com/mitmproxy/mitmproxy/blob/e6aa924bb411a9687b91920b8d094af37bc02b90/examples/contrib/webscanner_helper/test_urlindex.py
examples/contrib/webscanner_helper/test_urlindex.py
import json from json import JSONDecodeError from pathlib import Path from unittest import mock from unittest.mock import patch from examples.contrib.webscanner_helper.urlindex import filter_404 from examples.contrib.webscanner_helper.urlindex import JSONUrlIndexWriter from examples.contrib.webscanner_helper.urlindex ...
python
MIT
e6aa924bb411a9687b91920b8d094af37bc02b90
2026-01-04T14:40:00.086164Z
false
mitmproxy/mitmproxy
https://github.com/mitmproxy/mitmproxy/blob/e6aa924bb411a9687b91920b8d094af37bc02b90/examples/contrib/webscanner_helper/test_proxyauth_selenium.py
examples/contrib/webscanner_helper/test_proxyauth_selenium.py
from unittest import mock from unittest.mock import MagicMock import pytest from examples.contrib.webscanner_helper.proxyauth_selenium import AuthorizationOracle from examples.contrib.webscanner_helper.proxyauth_selenium import logger from examples.contrib.webscanner_helper.proxyauth_selenium import randomString from...
python
MIT
e6aa924bb411a9687b91920b8d094af37bc02b90
2026-01-04T14:40:00.086164Z
false
mitmproxy/mitmproxy
https://github.com/mitmproxy/mitmproxy/blob/e6aa924bb411a9687b91920b8d094af37bc02b90/examples/contrib/webscanner_helper/urldict.py
examples/contrib/webscanner_helper/urldict.py
import itertools import json from collections.abc import Callable from collections.abc import Generator from collections.abc import MutableMapping from typing import Any from typing import cast from typing import TextIO from mitmproxy import flowfilter from mitmproxy.http import HTTPFlow def f_id(x): return x ...
python
MIT
e6aa924bb411a9687b91920b8d094af37bc02b90
2026-01-04T14:40:00.086164Z
false
mitmproxy/mitmproxy
https://github.com/mitmproxy/mitmproxy/blob/e6aa924bb411a9687b91920b8d094af37bc02b90/examples/contrib/webscanner_helper/__init__.py
examples/contrib/webscanner_helper/__init__.py
python
MIT
e6aa924bb411a9687b91920b8d094af37bc02b90
2026-01-04T14:40:00.086164Z
false
mitmproxy/mitmproxy
https://github.com/mitmproxy/mitmproxy/blob/e6aa924bb411a9687b91920b8d094af37bc02b90/examples/contrib/webscanner_helper/test_urlinjection.py
examples/contrib/webscanner_helper/test_urlinjection.py
import json from unittest import mock from examples.contrib.webscanner_helper.urlinjection import HTMLInjection from examples.contrib.webscanner_helper.urlinjection import InjectionGenerator from examples.contrib.webscanner_helper.urlinjection import logger from examples.contrib.webscanner_helper.urlinjection import R...
python
MIT
e6aa924bb411a9687b91920b8d094af37bc02b90
2026-01-04T14:40:00.086164Z
false
mitmproxy/mitmproxy
https://github.com/mitmproxy/mitmproxy/blob/e6aa924bb411a9687b91920b8d094af37bc02b90/examples/contrib/webscanner_helper/test_watchdog.py
examples/contrib/webscanner_helper/test_watchdog.py
import multiprocessing import time from pathlib import Path from unittest import mock from examples.contrib.webscanner_helper.watchdog import logger from examples.contrib.webscanner_helper.watchdog import WatchdogAddon from mitmproxy.connections import ServerConnection from mitmproxy.exceptions import HttpSyntaxExcept...
python
MIT
e6aa924bb411a9687b91920b8d094af37bc02b90
2026-01-04T14:40:00.086164Z
false
mitmproxy/mitmproxy
https://github.com/mitmproxy/mitmproxy/blob/e6aa924bb411a9687b91920b8d094af37bc02b90/examples/addons/http-stream-simple.py
examples/addons/http-stream-simple.py
""" Select which responses should be streamed. Enable response streaming for all HTTP flows. This is equivalent to passing `--set stream_large_bodies=1` to mitmproxy. """ def responseheaders(flow): """ Enables streaming for all responses. This is equivalent to passing `--set stream_large_bodies=1` to mit...
python
MIT
e6aa924bb411a9687b91920b8d094af37bc02b90
2026-01-04T14:40:00.086164Z
false
mitmproxy/mitmproxy
https://github.com/mitmproxy/mitmproxy/blob/e6aa924bb411a9687b91920b8d094af37bc02b90/examples/addons/anatomy2.py
examples/addons/anatomy2.py
"""An addon using the abbreviated scripting syntax.""" def request(flow): flow.request.headers["myheader"] = "value"
python
MIT
e6aa924bb411a9687b91920b8d094af37bc02b90
2026-01-04T14:40:00.086164Z
false
mitmproxy/mitmproxy
https://github.com/mitmproxy/mitmproxy/blob/e6aa924bb411a9687b91920b8d094af37bc02b90/examples/addons/http-trailers.py
examples/addons/http-trailers.py
""" This script simply prints all received HTTP Trailers. HTTP requests and responses can contain trailing headers which are sent after the body is fully transmitted. Such trailers need to be announced in the initial headers by name, so the receiving endpoint can wait and read them after the body. """ from mitmproxy ...
python
MIT
e6aa924bb411a9687b91920b8d094af37bc02b90
2026-01-04T14:40:00.086164Z
false
mitmproxy/mitmproxy
https://github.com/mitmproxy/mitmproxy/blob/e6aa924bb411a9687b91920b8d094af37bc02b90/examples/addons/http-modify-form.py
examples/addons/http-modify-form.py
"""Modify an HTTP form submission.""" from mitmproxy import http def request(flow: http.HTTPFlow) -> None: if flow.request.urlencoded_form: # If there's already a form, one can just add items to the dict: flow.request.urlencoded_form["mitmproxy"] = "rocks" else: # One can also just pa...
python
MIT
e6aa924bb411a9687b91920b8d094af37bc02b90
2026-01-04T14:40:00.086164Z
false
mitmproxy/mitmproxy
https://github.com/mitmproxy/mitmproxy/blob/e6aa924bb411a9687b91920b8d094af37bc02b90/examples/addons/io-read-saved-flows.py
examples/addons/io-read-saved-flows.py
#!/usr/bin/env python """ Read a mitmproxy dump file. """ import pprint import sys from mitmproxy import http from mitmproxy import io from mitmproxy.exceptions import FlowReadException with open(sys.argv[1], "rb") as logfile: freader = io.FlowReader(logfile) pp = pprint.PrettyPrinter(indent=4) try: ...
python
MIT
e6aa924bb411a9687b91920b8d094af37bc02b90
2026-01-04T14:40:00.086164Z
false
mitmproxy/mitmproxy
https://github.com/mitmproxy/mitmproxy/blob/e6aa924bb411a9687b91920b8d094af37bc02b90/examples/addons/dns-simple.py
examples/addons/dns-simple.py
""" Spoof DNS responses. In this example, we fiddle with IPv6 (AAAA) records: - For example.com, `::1` is returned. (domain is hosted on localhost) - For example.org, an NXDOMAIN error is returned. (domain does not exist) - For all other domains, return a non-error response without any records. (domain exi...
python
MIT
e6aa924bb411a9687b91920b8d094af37bc02b90
2026-01-04T14:40:00.086164Z
false
mitmproxy/mitmproxy
https://github.com/mitmproxy/mitmproxy/blob/e6aa924bb411a9687b91920b8d094af37bc02b90/examples/addons/log-events.py
examples/addons/log-events.py
"""Post messages to mitmproxy's event log.""" import logging from mitmproxy.addonmanager import Loader from mitmproxy.log import ALERT logger = logging.getLogger(__name__) def load(loader: Loader): logger.info("This is some informative text.") logger.warning("This is a warning.") logger.error("This is ...
python
MIT
e6aa924bb411a9687b91920b8d094af37bc02b90
2026-01-04T14:40:00.086164Z
false
mitmproxy/mitmproxy
https://github.com/mitmproxy/mitmproxy/blob/e6aa924bb411a9687b91920b8d094af37bc02b90/examples/addons/filter-flows.py
examples/addons/filter-flows.py
""" Use mitmproxy's filter pattern in scripts. """ from __future__ import annotations import logging from mitmproxy import flowfilter from mitmproxy import http from mitmproxy.addonmanager import Loader class Filter: filter: flowfilter.TFilter def configure(self, updated): if "flowfilter" in updat...
python
MIT
e6aa924bb411a9687b91920b8d094af37bc02b90
2026-01-04T14:40:00.086164Z
false
mitmproxy/mitmproxy
https://github.com/mitmproxy/mitmproxy/blob/e6aa924bb411a9687b91920b8d094af37bc02b90/examples/addons/io-write-flow-file.py
examples/addons/io-write-flow-file.py
""" Generate a mitmproxy dump file. This script demonstrates how to generate a mitmproxy dump file, as it would also be generated by passing `-w` to mitmproxy. In contrast to `-w`, this gives you full control over which flows should be saved and also allows you to rotate files or log to multiple files in parallel. """...
python
MIT
e6aa924bb411a9687b91920b8d094af37bc02b90
2026-01-04T14:40:00.086164Z
false
mitmproxy/mitmproxy
https://github.com/mitmproxy/mitmproxy/blob/e6aa924bb411a9687b91920b8d094af37bc02b90/examples/addons/options-simple.py
examples/addons/options-simple.py
""" Add a new mitmproxy option. Usage: mitmproxy -s options-simple.py --set addheader=true """ from mitmproxy import ctx class AddHeader: def __init__(self): self.num = 0 def load(self, loader): loader.add_option( name="addheader", typespec=bool, def...
python
MIT
e6aa924bb411a9687b91920b8d094af37bc02b90
2026-01-04T14:40:00.086164Z
false
mitmproxy/mitmproxy
https://github.com/mitmproxy/mitmproxy/blob/e6aa924bb411a9687b91920b8d094af37bc02b90/examples/addons/duplicate-modify-replay.py
examples/addons/duplicate-modify-replay.py
"""Take incoming HTTP requests and replay them with modified parameters.""" from mitmproxy import ctx def request(flow): # Avoid an infinite loop by not replaying already replayed requests if flow.is_replay == "request": return flow = flow.copy() # Only interactive tools have a view. If we ha...
python
MIT
e6aa924bb411a9687b91920b8d094af37bc02b90
2026-01-04T14:40:00.086164Z
false
mitmproxy/mitmproxy
https://github.com/mitmproxy/mitmproxy/blob/e6aa924bb411a9687b91920b8d094af37bc02b90/examples/addons/contentview-interactive.py
examples/addons/contentview-interactive.py
from mitmproxy import contentviews class InteractiveSwapCase(contentviews.InteractiveContentview): def prettify( self, data: bytes, metadata: contentviews.Metadata, ) -> str: return data.swapcase().decode() def reencode( self, prettified: str, metad...
python
MIT
e6aa924bb411a9687b91920b8d094af37bc02b90
2026-01-04T14:40:00.086164Z
false
mitmproxy/mitmproxy
https://github.com/mitmproxy/mitmproxy/blob/e6aa924bb411a9687b91920b8d094af37bc02b90/examples/addons/commands-simple.py
examples/addons/commands-simple.py
"""Add a custom command to mitmproxy's command prompt.""" import logging from mitmproxy import command class MyAddon: def __init__(self): self.num = 0 @command.command("myaddon.inc") def inc(self) -> None: self.num += 1 logging.info(f"num = {self.num}") addons = [MyAddon()]
python
MIT
e6aa924bb411a9687b91920b8d094af37bc02b90
2026-01-04T14:40:00.086164Z
false
mitmproxy/mitmproxy
https://github.com/mitmproxy/mitmproxy/blob/e6aa924bb411a9687b91920b8d094af37bc02b90/examples/addons/shutdown.py
examples/addons/shutdown.py
""" A simple way of shutting down the mitmproxy instance to stop everything. Usage: mitmproxy -s shutdown.py and then send a HTTP request to trigger the shutdown: curl --proxy localhost:8080 http://example.com/path """ import logging from mitmproxy import ctx from mitmproxy import http def request(fl...
python
MIT
e6aa924bb411a9687b91920b8d094af37bc02b90
2026-01-04T14:40:00.086164Z
false
mitmproxy/mitmproxy
https://github.com/mitmproxy/mitmproxy/blob/e6aa924bb411a9687b91920b8d094af37bc02b90/examples/addons/websocket-simple.py
examples/addons/websocket-simple.py
"""Process individual messages from a WebSocket connection.""" import logging import re from mitmproxy import http def websocket_message(flow: http.HTTPFlow): assert flow.websocket is not None # make type checker happy # get the latest message message = flow.websocket.messages[-1] # was the messag...
python
MIT
e6aa924bb411a9687b91920b8d094af37bc02b90
2026-01-04T14:40:00.086164Z
false
mitmproxy/mitmproxy
https://github.com/mitmproxy/mitmproxy/blob/e6aa924bb411a9687b91920b8d094af37bc02b90/examples/addons/http-reply-from-proxy.py
examples/addons/http-reply-from-proxy.py
"""Send a reply from the proxy without sending the request to the remote server.""" from mitmproxy import http def request(flow: http.HTTPFlow) -> None: if flow.request.pretty_url == "http://example.com/path": flow.response = http.Response.make( 200, # (optional) status code b"He...
python
MIT
e6aa924bb411a9687b91920b8d094af37bc02b90
2026-01-04T14:40:00.086164Z
false
mitmproxy/mitmproxy
https://github.com/mitmproxy/mitmproxy/blob/e6aa924bb411a9687b91920b8d094af37bc02b90/examples/addons/internet-in-mirror.py
examples/addons/internet-in-mirror.py
""" Mirror all web pages. Useful if you are living down under. """ from mitmproxy import http def response(flow: http.HTTPFlow) -> None: if flow.response and flow.response.content: flow.response.content = flow.response.content.replace( b"</head>", b"<style>body {transform: scaleX(-1);}</styl...
python
MIT
e6aa924bb411a9687b91920b8d094af37bc02b90
2026-01-04T14:40:00.086164Z
false
mitmproxy/mitmproxy
https://github.com/mitmproxy/mitmproxy/blob/e6aa924bb411a9687b91920b8d094af37bc02b90/examples/addons/contentview.py
examples/addons/contentview.py
from mitmproxy import contentviews class SwapCase(contentviews.Contentview): def prettify(self, data: bytes, metadata: contentviews.Metadata) -> str: return data.swapcase().decode() def render_priority(self, data: bytes, metadata: contentviews.Metadata) -> float: if metadata.content_type and ...
python
MIT
e6aa924bb411a9687b91920b8d094af37bc02b90
2026-01-04T14:40:00.086164Z
false
mitmproxy/mitmproxy
https://github.com/mitmproxy/mitmproxy/blob/e6aa924bb411a9687b91920b8d094af37bc02b90/examples/addons/nonblocking.py
examples/addons/nonblocking.py
""" Make events hooks non-blocking using async or @concurrent. """ import asyncio import logging import time from mitmproxy.script import concurrent # Toggle between asyncio and thread-based alternatives. if True: # Hooks can be async, which allows the hook to call async functions and perform async I/O # wit...
python
MIT
e6aa924bb411a9687b91920b8d094af37bc02b90
2026-01-04T14:40:00.086164Z
false
mitmproxy/mitmproxy
https://github.com/mitmproxy/mitmproxy/blob/e6aa924bb411a9687b91920b8d094af37bc02b90/examples/addons/websocket-inject-message.py
examples/addons/websocket-inject-message.py
""" Inject a WebSocket message into a running connection. This example shows how to inject a WebSocket message into a running connection. """ import asyncio from mitmproxy import ctx from mitmproxy import http # Simple example: Inject a message as a response to an event def websocket_message(flow: http.HTTPFlow):...
python
MIT
e6aa924bb411a9687b91920b8d094af37bc02b90
2026-01-04T14:40:00.086164Z
false
mitmproxy/mitmproxy
https://github.com/mitmproxy/mitmproxy/blob/e6aa924bb411a9687b91920b8d094af37bc02b90/examples/addons/http-add-header.py
examples/addons/http-add-header.py
"""Add an HTTP header to each response.""" class AddHeader: def __init__(self): self.num = 0 def response(self, flow): self.num = self.num + 1 flow.response.headers["count"] = str(self.num) addons = [AddHeader()]
python
MIT
e6aa924bb411a9687b91920b8d094af37bc02b90
2026-01-04T14:40:00.086164Z
false
mitmproxy/mitmproxy
https://github.com/mitmproxy/mitmproxy/blob/e6aa924bb411a9687b91920b8d094af37bc02b90/examples/addons/tcp-simple.py
examples/addons/tcp-simple.py
""" Process individual messages from a TCP connection. This script replaces full occurrences of "foo" with "bar" and prints various details for each message. Please note that TCP is stream-based and *not* message-based. mitmproxy splits stream contents into "messages" as they are received by socket.recv(). This is pre...
python
MIT
e6aa924bb411a9687b91920b8d094af37bc02b90
2026-01-04T14:40:00.086164Z
false
mitmproxy/mitmproxy
https://github.com/mitmproxy/mitmproxy/blob/e6aa924bb411a9687b91920b8d094af37bc02b90/examples/addons/commands-flows.py
examples/addons/commands-flows.py
"""Handle flows as command arguments.""" import logging from collections.abc import Sequence from mitmproxy import command from mitmproxy import flow from mitmproxy import http from mitmproxy.log import ALERT class MyAddon: @command.command("myaddon.addheader") def addheader(self, flows: Sequence[flow.Flow]...
python
MIT
e6aa924bb411a9687b91920b8d094af37bc02b90
2026-01-04T14:40:00.086164Z
false
mitmproxy/mitmproxy
https://github.com/mitmproxy/mitmproxy/blob/e6aa924bb411a9687b91920b8d094af37bc02b90/examples/addons/wsgi-flask-app.py
examples/addons/wsgi-flask-app.py
""" Host a WSGI app in mitmproxy. This example shows how to graft a WSGI app onto mitmproxy. In this instance, we're using the Flask framework (http://flask.pocoo.org/) to expose a single simplest-possible page. """ from flask import Flask from mitmproxy.addons import asgiapp app = Flask("proxapp") @app.route("/"...
python
MIT
e6aa924bb411a9687b91920b8d094af37bc02b90
2026-01-04T14:40:00.086164Z
false
mitmproxy/mitmproxy
https://github.com/mitmproxy/mitmproxy/blob/e6aa924bb411a9687b91920b8d094af37bc02b90/examples/addons/http-redirect-requests.py
examples/addons/http-redirect-requests.py
"""Redirect HTTP requests to another server.""" from mitmproxy import http def request(flow: http.HTTPFlow) -> None: # pretty_host takes the "Host" header of the request into account, # which is useful in transparent mode where we usually only have the IP # otherwise. if flow.request.pretty_host == "...
python
MIT
e6aa924bb411a9687b91920b8d094af37bc02b90
2026-01-04T14:40:00.086164Z
false
mitmproxy/mitmproxy
https://github.com/mitmproxy/mitmproxy/blob/e6aa924bb411a9687b91920b8d094af37bc02b90/examples/addons/http-stream-modify.py
examples/addons/http-stream-modify.py
""" Modify a streamed response. Generally speaking, we recommend *not* to stream messages you need to modify. Modifying streamed responses is tricky and brittle: - If the transfer encoding isn't chunked, you cannot simply change the content length. - If you want to replace all occurrences of "foobar", make sur...
python
MIT
e6aa924bb411a9687b91920b8d094af37bc02b90
2026-01-04T14:40:00.086164Z
false
mitmproxy/mitmproxy
https://github.com/mitmproxy/mitmproxy/blob/e6aa924bb411a9687b91920b8d094af37bc02b90/examples/addons/http-modify-query-string.py
examples/addons/http-modify-query-string.py
"""Modify HTTP query parameters.""" from mitmproxy import http def request(flow: http.HTTPFlow) -> None: flow.request.query["mitmproxy"] = "rocks"
python
MIT
e6aa924bb411a9687b91920b8d094af37bc02b90
2026-01-04T14:40:00.086164Z
false
mitmproxy/mitmproxy
https://github.com/mitmproxy/mitmproxy/blob/e6aa924bb411a9687b91920b8d094af37bc02b90/examples/addons/options-configure.py
examples/addons/options-configure.py
"""React to configuration changes.""" from typing import Optional from mitmproxy import ctx from mitmproxy import exceptions class AddHeader: def load(self, loader): loader.add_option( name="addheader", typespec=Optional[int], default=None, help="Add a hea...
python
MIT
e6aa924bb411a9687b91920b8d094af37bc02b90
2026-01-04T14:40:00.086164Z
false
mitmproxy/mitmproxy
https://github.com/mitmproxy/mitmproxy/blob/e6aa924bb411a9687b91920b8d094af37bc02b90/examples/addons/anatomy.py
examples/addons/anatomy.py
""" Basic skeleton of a mitmproxy addon. Run as follows: mitmproxy -s anatomy.py """ import logging class Counter: def __init__(self): self.num = 0 def request(self, flow): self.num = self.num + 1 logging.info("We've seen %d flows" % self.num) addons = [Counter()]
python
MIT
e6aa924bb411a9687b91920b8d094af37bc02b90
2026-01-04T14:40:00.086164Z
false
mitmproxy/mitmproxy
https://github.com/mitmproxy/mitmproxy/blob/e6aa924bb411a9687b91920b8d094af37bc02b90/examples/addons/commands-paths.py
examples/addons/commands-paths.py
"""Handle file paths as command arguments.""" import logging from collections.abc import Sequence from mitmproxy import command from mitmproxy import flow from mitmproxy import http from mitmproxy import types from mitmproxy.log import ALERT class MyAddon: @command.command("myaddon.histogram") def histogram...
python
MIT
e6aa924bb411a9687b91920b8d094af37bc02b90
2026-01-04T14:40:00.086164Z
false
mitmproxy/mitmproxy
https://github.com/mitmproxy/mitmproxy/blob/e6aa924bb411a9687b91920b8d094af37bc02b90/web/gen/state_js.py
web/gen/state_js.py
#!/usr/bin/env python3 import asyncio import json import textwrap from pathlib import Path from unittest.mock import Mock from mitmproxy import options from mitmproxy.proxy.mode_servers import ServerInstance from mitmproxy.tools.web import app from mitmproxy.tools.web import master here = Path(__file__).parent.absol...
python
MIT
e6aa924bb411a9687b91920b8d094af37bc02b90
2026-01-04T14:40:00.086164Z
false
mitmproxy/mitmproxy
https://github.com/mitmproxy/mitmproxy/blob/e6aa924bb411a9687b91920b8d094af37bc02b90/web/gen/options_js.py
web/gen/options_js.py
#!/usr/bin/env python3 import asyncio import io import json from collections.abc import Sequence from contextlib import redirect_stdout from pathlib import Path from mitmproxy import options from mitmproxy import optmanager from mitmproxy.tools.web import master here = Path(__file__).parent.absolute() filename = he...
python
MIT
e6aa924bb411a9687b91920b8d094af37bc02b90
2026-01-04T14:40:00.086164Z
false
mitmproxy/mitmproxy
https://github.com/mitmproxy/mitmproxy/blob/e6aa924bb411a9687b91920b8d094af37bc02b90/web/gen/tflow_js.py
web/gen/tflow_js.py
#!/usr/bin/env python3 import asyncio import json import textwrap from pathlib import Path from mitmproxy import certs from mitmproxy.http import Headers from mitmproxy.test import tflow from mitmproxy.tools.web import app here = Path(__file__).parent.absolute() filename = here / "../src/js/__tests__/ducks/_tflow.t...
python
MIT
e6aa924bb411a9687b91920b8d094af37bc02b90
2026-01-04T14:40:00.086164Z
false
mitmproxy/mitmproxy
https://github.com/mitmproxy/mitmproxy/blob/e6aa924bb411a9687b91920b8d094af37bc02b90/web/gen/web_columns.py
web/gen/web_columns.py
#!/usr/bin/env python3 import asyncio import json import re from pathlib import Path here = Path(__file__).parent.absolute() input_filename = here / "../src/js/components/FlowTable/FlowColumns.tsx" filename = here / "../../mitmproxy/tools/web/web_columns.py" def extract_columns() -> list: # Read the Typescript...
python
MIT
e6aa924bb411a9687b91920b8d094af37bc02b90
2026-01-04T14:40:00.086164Z
false
mitmproxy/mitmproxy
https://github.com/mitmproxy/mitmproxy/blob/e6aa924bb411a9687b91920b8d094af37bc02b90/web/gen/backend_consts.py
web/gen/backend_consts.py
#!/usr/bin/env python3 import asyncio import typing from pathlib import Path from mitmproxy.contentviews import SyntaxHighlight from mitmproxy.proxy.mode_specs import ReverseMode here = Path(__file__).parent.absolute() filename = here / "../src/js/backends/consts.ts" async def make() -> str: protocols = typin...
python
MIT
e6aa924bb411a9687b91920b8d094af37bc02b90
2026-01-04T14:40:00.086164Z
false
mitmproxy/mitmproxy
https://github.com/mitmproxy/mitmproxy/blob/e6aa924bb411a9687b91920b8d094af37bc02b90/mitmproxy/tls.py
mitmproxy/tls.py
import io from dataclasses import dataclass from kaitaistruct import KaitaiStream from OpenSSL import SSL from mitmproxy import connection from mitmproxy.contrib.kaitaistruct import dtls_client_hello from mitmproxy.contrib.kaitaistruct import tls_client_hello from mitmproxy.net import check from mitmproxy.proxy impor...
python
MIT
e6aa924bb411a9687b91920b8d094af37bc02b90
2026-01-04T14:40:00.086164Z
false
mitmproxy/mitmproxy
https://github.com/mitmproxy/mitmproxy/blob/e6aa924bb411a9687b91920b8d094af37bc02b90/mitmproxy/master.py
mitmproxy/master.py
import asyncio import logging from . import ctx as mitmproxy_ctx from .addons import termlog from .proxy.mode_specs import ReverseMode from .utils import asyncio_utils from mitmproxy import addonmanager from mitmproxy import command from mitmproxy import eventsequence from mitmproxy import hooks from mitmproxy import ...
python
MIT
e6aa924bb411a9687b91920b8d094af37bc02b90
2026-01-04T14:40:00.086164Z
false
mitmproxy/mitmproxy
https://github.com/mitmproxy/mitmproxy/blob/e6aa924bb411a9687b91920b8d094af37bc02b90/mitmproxy/http.py
mitmproxy/http.py
import binascii import json import os import time import urllib.parse import warnings from collections.abc import Callable from collections.abc import Iterable from collections.abc import Iterator from collections.abc import Mapping from collections.abc import Sequence from dataclasses import dataclass from dataclasses...
python
MIT
e6aa924bb411a9687b91920b8d094af37bc02b90
2026-01-04T14:40:00.086164Z
true
mitmproxy/mitmproxy
https://github.com/mitmproxy/mitmproxy/blob/e6aa924bb411a9687b91920b8d094af37bc02b90/mitmproxy/command_lexer.py
mitmproxy/command_lexer.py
import re import pyparsing # TODO: There is a lot of work to be done here. # The current implementation is written in a way that _any_ input is valid, # which does not make sense once things get more complex. PartialQuotedString = pyparsing.Regex( re.compile( r""" "[^"]*(?:"|$) # double-quot...
python
MIT
e6aa924bb411a9687b91920b8d094af37bc02b90
2026-01-04T14:40:00.086164Z
false
mitmproxy/mitmproxy
https://github.com/mitmproxy/mitmproxy/blob/e6aa924bb411a9687b91920b8d094af37bc02b90/mitmproxy/addonmanager.py
mitmproxy/addonmanager.py
import contextlib import inspect import logging import pprint import sys import traceback import types from collections.abc import Callable from collections.abc import Sequence from dataclasses import dataclass from typing import Any from mitmproxy import exceptions from mitmproxy import flow from mitmproxy import hoo...
python
MIT
e6aa924bb411a9687b91920b8d094af37bc02b90
2026-01-04T14:40:00.086164Z
false
mitmproxy/mitmproxy
https://github.com/mitmproxy/mitmproxy/blob/e6aa924bb411a9687b91920b8d094af37bc02b90/mitmproxy/websocket.py
mitmproxy/websocket.py
""" Mitmproxy used to have its own WebSocketFlow type until mitmproxy 6, but now WebSocket connections now are represented as HTTP flows as well. They can be distinguished from regular HTTP requests by having the `mitmproxy.http.HTTPFlow.websocket` attribute set. This module only defines the classes for individual `We...
python
MIT
e6aa924bb411a9687b91920b8d094af37bc02b90
2026-01-04T14:40:00.086164Z
false
mitmproxy/mitmproxy
https://github.com/mitmproxy/mitmproxy/blob/e6aa924bb411a9687b91920b8d094af37bc02b90/mitmproxy/exceptions.py
mitmproxy/exceptions.py
""" Edit 2020-12 @mhils: The advice below hasn't paid off in any form. We now just use builtin exceptions and specialize where necessary. --- We try to be very hygienic regarding the exceptions we throw: - Every exception that might be externally visible to users shall be a subclass of MitmproxyException.p - ...
python
MIT
e6aa924bb411a9687b91920b8d094af37bc02b90
2026-01-04T14:40:00.086164Z
false
mitmproxy/mitmproxy
https://github.com/mitmproxy/mitmproxy/blob/e6aa924bb411a9687b91920b8d094af37bc02b90/mitmproxy/tcp.py
mitmproxy/tcp.py
import time from mitmproxy import connection from mitmproxy import flow from mitmproxy.coretypes import serializable class TCPMessage(serializable.Serializable): """ An individual TCP "message". Note that TCP is *stream-based* and not *message-based*. For practical purposes the stream is chunked into...
python
MIT
e6aa924bb411a9687b91920b8d094af37bc02b90
2026-01-04T14:40:00.086164Z
false
mitmproxy/mitmproxy
https://github.com/mitmproxy/mitmproxy/blob/e6aa924bb411a9687b91920b8d094af37bc02b90/mitmproxy/version.py
mitmproxy/version.py
import os import subprocess import sys VERSION = "13.0.0.dev" MITMPROXY = "mitmproxy " + VERSION # Serialization format version. This is displayed nowhere, it just needs to be incremented by one # for each change in the file format. FLOW_FORMAT_VERSION = 21 def get_dev_version() -> str: """ Return a detaile...
python
MIT
e6aa924bb411a9687b91920b8d094af37bc02b90
2026-01-04T14:40:00.086164Z
false
mitmproxy/mitmproxy
https://github.com/mitmproxy/mitmproxy/blob/e6aa924bb411a9687b91920b8d094af37bc02b90/mitmproxy/command.py
mitmproxy/command.py
""" This module manages and invokes typed commands. """ import functools import inspect import logging import sys import textwrap import types from collections.abc import Callable from collections.abc import Iterable from collections.abc import Sequence from typing import Any from typing import NamedTuple import pypa...
python
MIT
e6aa924bb411a9687b91920b8d094af37bc02b90
2026-01-04T14:40:00.086164Z
false
mitmproxy/mitmproxy
https://github.com/mitmproxy/mitmproxy/blob/e6aa924bb411a9687b91920b8d094af37bc02b90/mitmproxy/dns.py
mitmproxy/dns.py
from __future__ import annotations import base64 import itertools import random import struct import time from collections.abc import Iterable from dataclasses import dataclass from ipaddress import IPv4Address from ipaddress import IPv6Address from typing import Any from typing import cast from typing import ClassVar...
python
MIT
e6aa924bb411a9687b91920b8d094af37bc02b90
2026-01-04T14:40:00.086164Z
false
mitmproxy/mitmproxy
https://github.com/mitmproxy/mitmproxy/blob/e6aa924bb411a9687b91920b8d094af37bc02b90/mitmproxy/log.py
mitmproxy/log.py
from __future__ import annotations import logging import os import typing import warnings from dataclasses import dataclass from mitmproxy import hooks from mitmproxy.contrib import click as miniclick from mitmproxy.utils import human if typing.TYPE_CHECKING: from mitmproxy import master ALERT = logging.INFO + ...
python
MIT
e6aa924bb411a9687b91920b8d094af37bc02b90
2026-01-04T14:40:00.086164Z
false
mitmproxy/mitmproxy
https://github.com/mitmproxy/mitmproxy/blob/e6aa924bb411a9687b91920b8d094af37bc02b90/mitmproxy/flowfilter.py
mitmproxy/flowfilter.py
""" The following operators are understood: ~q Request ~s Response Headers: Patterns are matched against "name: value" strings. Field names are all-lowercase. ~a Asset content-type in response. Asset content types are: text/javascript ...
python
MIT
e6aa924bb411a9687b91920b8d094af37bc02b90
2026-01-04T14:40:00.086164Z
false
mitmproxy/mitmproxy
https://github.com/mitmproxy/mitmproxy/blob/e6aa924bb411a9687b91920b8d094af37bc02b90/mitmproxy/flow.py
mitmproxy/flow.py
from __future__ import annotations import asyncio import copy import time import uuid from dataclasses import dataclass from dataclasses import field from typing import Any from typing import ClassVar from mitmproxy import connection from mitmproxy import exceptions from mitmproxy import version from mitmproxy.corety...
python
MIT
e6aa924bb411a9687b91920b8d094af37bc02b90
2026-01-04T14:40:00.086164Z
false
mitmproxy/mitmproxy
https://github.com/mitmproxy/mitmproxy/blob/e6aa924bb411a9687b91920b8d094af37bc02b90/mitmproxy/udp.py
mitmproxy/udp.py
import time from mitmproxy import connection from mitmproxy import flow from mitmproxy.coretypes import serializable class UDPMessage(serializable.Serializable): """ An individual UDP datagram. """ def __init__(self, from_client, content, timestamp=None): self.from_client = from_client ...
python
MIT
e6aa924bb411a9687b91920b8d094af37bc02b90
2026-01-04T14:40:00.086164Z
false
mitmproxy/mitmproxy
https://github.com/mitmproxy/mitmproxy/blob/e6aa924bb411a9687b91920b8d094af37bc02b90/mitmproxy/eventsequence.py
mitmproxy/eventsequence.py
from collections.abc import Callable from collections.abc import Iterator from typing import Any from mitmproxy import dns from mitmproxy import flow from mitmproxy import hooks from mitmproxy import http from mitmproxy import tcp from mitmproxy import udp from mitmproxy.proxy import layers TEventGenerator = Iterator...
python
MIT
e6aa924bb411a9687b91920b8d094af37bc02b90
2026-01-04T14:40:00.086164Z
false
mitmproxy/mitmproxy
https://github.com/mitmproxy/mitmproxy/blob/e6aa924bb411a9687b91920b8d094af37bc02b90/mitmproxy/connection.py
mitmproxy/connection.py
import dataclasses import time import uuid import warnings from abc import ABCMeta from collections.abc import Sequence from dataclasses import dataclass from dataclasses import field from enum import Flag from typing import Literal from mitmproxy import certs from mitmproxy.coretypes import serializable from mitmprox...
python
MIT
e6aa924bb411a9687b91920b8d094af37bc02b90
2026-01-04T14:40:00.086164Z
false
mitmproxy/mitmproxy
https://github.com/mitmproxy/mitmproxy/blob/e6aa924bb411a9687b91920b8d094af37bc02b90/mitmproxy/__init__.py
mitmproxy/__init__.py
python
MIT
e6aa924bb411a9687b91920b8d094af37bc02b90
2026-01-04T14:40:00.086164Z
false
mitmproxy/mitmproxy
https://github.com/mitmproxy/mitmproxy/blob/e6aa924bb411a9687b91920b8d094af37bc02b90/mitmproxy/types.py
mitmproxy/types.py
import codecs import glob import os import re from collections.abc import Sequence from typing import Any from typing import TYPE_CHECKING from typing import Union from mitmproxy import exceptions from mitmproxy import flow from mitmproxy.utils import emoji from mitmproxy.utils import strutils if TYPE_CHECKING: # pr...
python
MIT
e6aa924bb411a9687b91920b8d094af37bc02b90
2026-01-04T14:40:00.086164Z
false
mitmproxy/mitmproxy
https://github.com/mitmproxy/mitmproxy/blob/e6aa924bb411a9687b91920b8d094af37bc02b90/mitmproxy/certs.py
mitmproxy/certs.py
import contextlib import datetime import ipaddress import logging import os import sys import warnings from collections.abc import Iterable from dataclasses import dataclass from pathlib import Path from typing import cast from typing import NewType from typing import Optional from typing import Union import OpenSSL f...
python
MIT
e6aa924bb411a9687b91920b8d094af37bc02b90
2026-01-04T14:40:00.086164Z
false
mitmproxy/mitmproxy
https://github.com/mitmproxy/mitmproxy/blob/e6aa924bb411a9687b91920b8d094af37bc02b90/mitmproxy/ctx.py
mitmproxy/ctx.py
from __future__ import annotations import typing if typing.TYPE_CHECKING: import mitmproxy.log import mitmproxy.master import mitmproxy.options master: mitmproxy.master.Master options: mitmproxy.options.Options log: mitmproxy.log.Log """Deprecated: Use Python's builtin `logging` module instead."""
python
MIT
e6aa924bb411a9687b91920b8d094af37bc02b90
2026-01-04T14:40:00.086164Z
false
mitmproxy/mitmproxy
https://github.com/mitmproxy/mitmproxy/blob/e6aa924bb411a9687b91920b8d094af37bc02b90/mitmproxy/hooks.py
mitmproxy/hooks.py
import re import warnings from collections.abc import Sequence from dataclasses import dataclass from dataclasses import fields from dataclasses import is_dataclass from typing import Any from typing import ClassVar from typing import TYPE_CHECKING import mitmproxy.flow if TYPE_CHECKING: import mitmproxy.addonman...
python
MIT
e6aa924bb411a9687b91920b8d094af37bc02b90
2026-01-04T14:40:00.086164Z
false
mitmproxy/mitmproxy
https://github.com/mitmproxy/mitmproxy/blob/e6aa924bb411a9687b91920b8d094af37bc02b90/mitmproxy/optmanager.py
mitmproxy/optmanager.py
from __future__ import annotations import contextlib import copy import pprint import textwrap import weakref from collections.abc import Callable from collections.abc import Iterable from collections.abc import Sequence from dataclasses import dataclass from pathlib import Path from typing import Any from typing impo...
python
MIT
e6aa924bb411a9687b91920b8d094af37bc02b90
2026-01-04T14:40:00.086164Z
false
mitmproxy/mitmproxy
https://github.com/mitmproxy/mitmproxy/blob/e6aa924bb411a9687b91920b8d094af37bc02b90/mitmproxy/options.py
mitmproxy/options.py
from collections.abc import Sequence from typing import Optional from mitmproxy import optmanager CONF_DIR = "~/.mitmproxy" CONF_BASENAME = "mitmproxy" CONTENT_VIEW_LINES_CUTOFF = 512 KEY_SIZE = 2048 class Options(optmanager.OptManager): def __init__(self, **kwargs) -> None: super().__init__() s...
python
MIT
e6aa924bb411a9687b91920b8d094af37bc02b90
2026-01-04T14:40:00.086164Z
false
mitmproxy/mitmproxy
https://github.com/mitmproxy/mitmproxy/blob/e6aa924bb411a9687b91920b8d094af37bc02b90/mitmproxy/tools/dump.py
mitmproxy/tools/dump.py
from mitmproxy import addons from mitmproxy import master from mitmproxy import options from mitmproxy.addons import dumper from mitmproxy.addons import errorcheck from mitmproxy.addons import keepserving from mitmproxy.addons import readfile class DumpMaster(master.Master): def __init__( self, op...
python
MIT
e6aa924bb411a9687b91920b8d094af37bc02b90
2026-01-04T14:40:00.086164Z
false
mitmproxy/mitmproxy
https://github.com/mitmproxy/mitmproxy/blob/e6aa924bb411a9687b91920b8d094af37bc02b90/mitmproxy/tools/main.py
mitmproxy/tools/main.py
from __future__ import annotations import argparse import asyncio import logging import os import signal import sys from collections.abc import Callable from collections.abc import Sequence from typing import Any from typing import TypeVar from mitmproxy import exceptions from mitmproxy import master from mitmproxy i...
python
MIT
e6aa924bb411a9687b91920b8d094af37bc02b90
2026-01-04T14:40:00.086164Z
false
mitmproxy/mitmproxy
https://github.com/mitmproxy/mitmproxy/blob/e6aa924bb411a9687b91920b8d094af37bc02b90/mitmproxy/tools/__init__.py
mitmproxy/tools/__init__.py
python
MIT
e6aa924bb411a9687b91920b8d094af37bc02b90
2026-01-04T14:40:00.086164Z
false
mitmproxy/mitmproxy
https://github.com/mitmproxy/mitmproxy/blob/e6aa924bb411a9687b91920b8d094af37bc02b90/mitmproxy/tools/cmdline.py
mitmproxy/tools/cmdline.py
import argparse def common_options(parser, opts): parser.add_argument( "--version", action="store_true", help="show version number and exit", dest="version", ) parser.add_argument( "--options", action="store_true", help="Show all options and their de...
python
MIT
e6aa924bb411a9687b91920b8d094af37bc02b90
2026-01-04T14:40:00.086164Z
false
mitmproxy/mitmproxy
https://github.com/mitmproxy/mitmproxy/blob/e6aa924bb411a9687b91920b8d094af37bc02b90/mitmproxy/tools/console/eventlog.py
mitmproxy/tools/console/eventlog.py
import collections import urwid from mitmproxy import log from mitmproxy.tools.console import layoutwidget class LogBufferWalker(urwid.SimpleListWalker): pass class EventLog(urwid.ListBox, layoutwidget.LayoutWidget): keyctx = "eventlog" title = "Events" def __init__(self, master): self.ma...
python
MIT
e6aa924bb411a9687b91920b8d094af37bc02b90
2026-01-04T14:40:00.086164Z
false
mitmproxy/mitmproxy
https://github.com/mitmproxy/mitmproxy/blob/e6aa924bb411a9687b91920b8d094af37bc02b90/mitmproxy/tools/console/palettes.py
mitmproxy/tools/console/palettes.py
# Low-color themes should ONLY use the standard foreground and background # colours listed here: # # http://urwid.org/manual/displayattributes.html # from __future__ import annotations from collections.abc import Mapping from collections.abc import Sequence class Palette: _fields = [ "background", ...
python
MIT
e6aa924bb411a9687b91920b8d094af37bc02b90
2026-01-04T14:40:00.086164Z
false
mitmproxy/mitmproxy
https://github.com/mitmproxy/mitmproxy/blob/e6aa924bb411a9687b91920b8d094af37bc02b90/mitmproxy/tools/console/master.py
mitmproxy/tools/console/master.py
import asyncio import contextlib import mimetypes import os.path import shlex import shutil import stat import subprocess import sys import tempfile import threading from typing import TypeVar import urwid from tornado.platform.asyncio import AddThreadSelectorEventLoop from mitmproxy import addons from mitmproxy impo...
python
MIT
e6aa924bb411a9687b91920b8d094af37bc02b90
2026-01-04T14:40:00.086164Z
false
mitmproxy/mitmproxy
https://github.com/mitmproxy/mitmproxy/blob/e6aa924bb411a9687b91920b8d094af37bc02b90/mitmproxy/tools/console/commandexecutor.py
mitmproxy/tools/console/commandexecutor.py
import logging from collections.abc import Sequence from mitmproxy import exceptions from mitmproxy import flow from mitmproxy.tools.console import overlay from mitmproxy.tools.console import signals class CommandExecutor: def __init__(self, master): self.master = master def __call__(self, cmd: str)...
python
MIT
e6aa924bb411a9687b91920b8d094af37bc02b90
2026-01-04T14:40:00.086164Z
false
mitmproxy/mitmproxy
https://github.com/mitmproxy/mitmproxy/blob/e6aa924bb411a9687b91920b8d094af37bc02b90/mitmproxy/tools/console/common.py
mitmproxy/tools/console/common.py
import enum import math import platform from collections.abc import Iterable from functools import lru_cache import urwid.util from publicsuffix2 import get_sld from publicsuffix2 import get_tld from mitmproxy import dns from mitmproxy import flow from mitmproxy.dns import DNSFlow from mitmproxy.http import HTTPFlow ...
python
MIT
e6aa924bb411a9687b91920b8d094af37bc02b90
2026-01-04T14:40:00.086164Z
false
mitmproxy/mitmproxy
https://github.com/mitmproxy/mitmproxy/blob/e6aa924bb411a9687b91920b8d094af37bc02b90/mitmproxy/tools/console/searchable.py
mitmproxy/tools/console/searchable.py
import urwid from mitmproxy.tools.console import signals class Highlight(urwid.AttrMap): def __init__(self, t): urwid.AttrMap.__init__( self, urwid.Text(t.text), "focusfield", ) self.backup = t class Searchable(urwid.ListBox): def __init__(self, c...
python
MIT
e6aa924bb411a9687b91920b8d094af37bc02b90
2026-01-04T14:40:00.086164Z
false
mitmproxy/mitmproxy
https://github.com/mitmproxy/mitmproxy/blob/e6aa924bb411a9687b91920b8d094af37bc02b90/mitmproxy/tools/console/signals.py
mitmproxy/tools/console/signals.py
from __future__ import annotations from collections.abc import Callable from typing import Union from mitmproxy.utils import signals StatusMessage = Union[tuple[str, str], str] # Show a status message in the action bar # Instead of using this signal directly, consider emitting a log event. def _status_message(mess...
python
MIT
e6aa924bb411a9687b91920b8d094af37bc02b90
2026-01-04T14:40:00.086164Z
false
mitmproxy/mitmproxy
https://github.com/mitmproxy/mitmproxy/blob/e6aa924bb411a9687b91920b8d094af37bc02b90/mitmproxy/tools/console/keybindings.py
mitmproxy/tools/console/keybindings.py
import textwrap import urwid from mitmproxy.tools.console import layoutwidget from mitmproxy.tools.console import signals from mitmproxy.utils import signals as utils_signals HELP_HEIGHT = 5 class KeyItem(urwid.WidgetWrap): def __init__(self, walker, binding, focused): self.walker, self.binding, self.f...
python
MIT
e6aa924bb411a9687b91920b8d094af37bc02b90
2026-01-04T14:40:00.086164Z
false
mitmproxy/mitmproxy
https://github.com/mitmproxy/mitmproxy/blob/e6aa924bb411a9687b91920b8d094af37bc02b90/mitmproxy/tools/console/commands.py
mitmproxy/tools/console/commands.py
import textwrap import urwid from mitmproxy import command from mitmproxy.tools.console import layoutwidget from mitmproxy.tools.console import signals from mitmproxy.utils import signals as utils_signals HELP_HEIGHT = 5 command_focus_change = utils_signals.SyncSignal(lambda text: None) class CommandItem(urwid.Wi...
python
MIT
e6aa924bb411a9687b91920b8d094af37bc02b90
2026-01-04T14:40:00.086164Z
false
mitmproxy/mitmproxy
https://github.com/mitmproxy/mitmproxy/blob/e6aa924bb411a9687b91920b8d094af37bc02b90/mitmproxy/tools/console/layoutwidget.py
mitmproxy/tools/console/layoutwidget.py
from typing import ClassVar class LayoutWidget: """ All top-level layout widgets and all widgets that may be set in an overlay must comply with this API. """ # Title is only required for windows, not overlay components title = "" keyctx: ClassVar[str] = "" def key_responder(self): ...
python
MIT
e6aa924bb411a9687b91920b8d094af37bc02b90
2026-01-04T14:40:00.086164Z
false
mitmproxy/mitmproxy
https://github.com/mitmproxy/mitmproxy/blob/e6aa924bb411a9687b91920b8d094af37bc02b90/mitmproxy/tools/console/keymap.py
mitmproxy/tools/console/keymap.py
import logging import os from collections import defaultdict from collections.abc import Sequence from functools import cache import ruamel.yaml.error import mitmproxy.types from mitmproxy import command from mitmproxy import ctx from mitmproxy import exceptions from mitmproxy.tools.console import commandexecutor fro...
python
MIT
e6aa924bb411a9687b91920b8d094af37bc02b90
2026-01-04T14:40:00.086164Z
false
mitmproxy/mitmproxy
https://github.com/mitmproxy/mitmproxy/blob/e6aa924bb411a9687b91920b8d094af37bc02b90/mitmproxy/tools/console/__init__.py
mitmproxy/tools/console/__init__.py
from mitmproxy.tools.console import master __all__ = ["master"]
python
MIT
e6aa924bb411a9687b91920b8d094af37bc02b90
2026-01-04T14:40:00.086164Z
false
mitmproxy/mitmproxy
https://github.com/mitmproxy/mitmproxy/blob/e6aa924bb411a9687b91920b8d094af37bc02b90/mitmproxy/tools/console/defaultkeys.py
mitmproxy/tools/console/defaultkeys.py
from mitmproxy.tools.console.keymap import Keymap def map(km: Keymap) -> None: km.add(":", "console.command ", ["commonkey", "global"], "Command prompt") km.add( ";", "console.command flow.comment @focus ''", ["flowlist", "flowview"], "Add comment to flow", ) km.add("?"...
python
MIT
e6aa924bb411a9687b91920b8d094af37bc02b90
2026-01-04T14:40:00.086164Z
false
mitmproxy/mitmproxy
https://github.com/mitmproxy/mitmproxy/blob/e6aa924bb411a9687b91920b8d094af37bc02b90/mitmproxy/tools/console/flowview.py
mitmproxy/tools/console/flowview.py
import sys from functools import lru_cache import urwid import mitmproxy.flow import mitmproxy.tools.console.master import mitmproxy_rs.syntax_highlight from mitmproxy import contentviews from mitmproxy import ctx from mitmproxy import dns from mitmproxy import http from mitmproxy import tcp from mitmproxy import udp...
python
MIT
e6aa924bb411a9687b91920b8d094af37bc02b90
2026-01-04T14:40:00.086164Z
false
mitmproxy/mitmproxy
https://github.com/mitmproxy/mitmproxy/blob/e6aa924bb411a9687b91920b8d094af37bc02b90/mitmproxy/tools/console/quickhelp.py
mitmproxy/tools/console/quickhelp.py
""" This module is reponsible for drawing the quick key help at the bottom of mitmproxy. """ from dataclasses import dataclass from typing import Union import urwid from mitmproxy import flow from mitmproxy.http import HTTPFlow from mitmproxy.tools.console.eventlog import EventLog from mitmproxy.tools.console.flowli...
python
MIT
e6aa924bb411a9687b91920b8d094af37bc02b90
2026-01-04T14:40:00.086164Z
false
mitmproxy/mitmproxy
https://github.com/mitmproxy/mitmproxy/blob/e6aa924bb411a9687b91920b8d094af37bc02b90/mitmproxy/tools/console/statusbar.py
mitmproxy/tools/console/statusbar.py
from __future__ import annotations from collections.abc import Callable from functools import lru_cache import urwid import mitmproxy.tools.console.master from mitmproxy.tools.console import commandexecutor from mitmproxy.tools.console import common from mitmproxy.tools.console import flowlist from mitmproxy.tools.c...
python
MIT
e6aa924bb411a9687b91920b8d094af37bc02b90
2026-01-04T14:40:00.086164Z
false
mitmproxy/mitmproxy
https://github.com/mitmproxy/mitmproxy/blob/e6aa924bb411a9687b91920b8d094af37bc02b90/mitmproxy/tools/console/flowlist.py
mitmproxy/tools/console/flowlist.py
from functools import lru_cache import urwid import mitmproxy.tools.console.master from mitmproxy.tools.console import common from mitmproxy.tools.console import layoutwidget class FlowItem(urwid.WidgetWrap): def __init__(self, master, flow): self.master, self.flow = master, flow w = self.get_te...
python
MIT
e6aa924bb411a9687b91920b8d094af37bc02b90
2026-01-04T14:40:00.086164Z
false
mitmproxy/mitmproxy
https://github.com/mitmproxy/mitmproxy/blob/e6aa924bb411a9687b91920b8d094af37bc02b90/mitmproxy/tools/console/tabs.py
mitmproxy/tools/console/tabs.py
import urwid class Tab(urwid.WidgetWrap): def __init__(self, offset, content, attr, onclick): """ onclick is called on click with the tab offset as argument """ p = urwid.Text(content, align="center") p = urwid.Padding(p, align="center", width=("relative", 100)) p =...
python
MIT
e6aa924bb411a9687b91920b8d094af37bc02b90
2026-01-04T14:40:00.086164Z
false
mitmproxy/mitmproxy
https://github.com/mitmproxy/mitmproxy/blob/e6aa924bb411a9687b91920b8d094af37bc02b90/mitmproxy/tools/console/flowdetailview.py
mitmproxy/tools/console/flowdetailview.py
import urwid import mitmproxy.flow from mitmproxy import http from mitmproxy.tools.console import common from mitmproxy.tools.console import searchable from mitmproxy.utils import human from mitmproxy.utils import strutils def maybe_timestamp(base, attr): if base is not None and getattr(base, attr): retu...
python
MIT
e6aa924bb411a9687b91920b8d094af37bc02b90
2026-01-04T14:40:00.086164Z
false