2025-12-25 upload

This commit is contained in:
“shengyudong”
2025-12-25 11:16:59 +08:00
commit 322ac74336
2241 changed files with 639966 additions and 0 deletions

View File

@@ -0,0 +1,13 @@
import sys
import types
from .mitmproxy_rs import *
__doc__ = mitmproxy_rs.__doc__
if hasattr(mitmproxy_rs, "__all__"):
__all__ = mitmproxy_rs.__all__
# Hacky workaround for https://github.com/PyO3/pyo3/issues/759
for k, v in vars(mitmproxy_rs).items():
if isinstance(v, types.ModuleType):
sys.modules[f"mitmproxy_rs.{k}"] = v

View File

@@ -0,0 +1,69 @@
from __future__ import annotations
from typing import Any, Literal
from typing import final, overload, TypeVar
from . import certs, contentviews, dns, local, process_info, tun, udp, wireguard, syntax_highlight
T = TypeVar("T")
# TCP / UDP
@final
class Stream:
async def read(self, n: int) -> bytes: ...
def write(self, data: bytes): ...
async def drain(self) -> None: ...
def write_eof(self): ...
def close(self): ...
def is_closing(self) -> bool: ...
async def wait_closed(self) -> None: ...
@overload
def get_extra_info(
self, name: Literal["transport_protocol"], default: None = None
) -> Literal["tcp", "udp"]: ...
@overload
def get_extra_info(
self, name: Literal["transport_protocol"], default: T
) -> Literal["tcp", "udp"] | T: ...
@overload
def get_extra_info(
self,
name: Literal[
"peername", "sockname", "original_src", "original_dst", "remote_endpoint"
],
default: None = None,
) -> tuple[str, int]: ...
@overload
def get_extra_info(
self,
name: Literal[
"peername", "sockname", "original_src", "original_dst", "remote_endpoint"
],
default: T,
) -> tuple[str, int] | T: ...
@overload
def get_extra_info(self, name: Literal["pid"], default: None = None) -> int: ...
@overload
def get_extra_info(self, name: Literal["pid"], default: T) -> int | T: ...
@overload
def get_extra_info(
self, name: Literal["process_name"], default: None = None
) -> str: ...
@overload
def get_extra_info(self, name: Literal["process_name"], default: T) -> str | T: ...
@overload
def get_extra_info(self, name: str, default: Any) -> Any: ...
def __repr__(self) -> str: ...
__all__ = [
"certs",
"contentviews",
"dns",
"local",
"process_info",
"syntax_highlight",
"tun",
"udp",
"wireguard",
"Stream",
]

View File

@@ -0,0 +1,7 @@
from pathlib import Path
here = Path(__file__).parent.absolute()
def hook_dirs() -> list[str]:
return [str(here)]

View File

@@ -0,0 +1,6 @@
import sysconfig
import os.path
binaries = [
(os.path.join(sysconfig.get_path("scripts"), "mitmproxy-linux-redirector"), ".")
]

View File

@@ -0,0 +1,3 @@
from PyInstaller.utils.hooks import collect_data_files
datas = collect_data_files("mitmproxy_macos")

View File

@@ -0,0 +1,14 @@
import platform
from PyInstaller.utils.hooks import collect_data_files
datas = collect_data_files("mitmproxy_rs")
hiddenimports = []
match platform.system():
case "Darwin":
hiddenimports.append("mitmproxy_macos")
case "Windows":
hiddenimports.append("mitmproxy_windows")
case "Linux":
hiddenimports.append("mitmproxy_linux")

View File

@@ -0,0 +1,3 @@
from PyInstaller.utils.hooks import collect_data_files
datas = collect_data_files("mitmproxy_windows")

View File

@@ -0,0 +1,9 @@
from __future__ import annotations
def add_cert(pem: str) -> None: ...
def remove_cert() -> None: ...
__all__ = [
"add_cert",
"remove_cert",
]

View File

@@ -0,0 +1,37 @@
from __future__ import annotations
from typing import ClassVar, final, Literal
class Contentview:
name: ClassVar[str]
syntax_highlight: ClassVar[Literal["xml", "yaml", "none", "error"]]
def prettify(self, data: bytes, metadata) -> str:
pass
def render_priority(self, data: bytes, metadata) -> float:
pass
@final
class InteractiveContentview(Contentview):
def reencode(self, data: str, metadata) -> bytes:
pass
_test_inspect_metadata: Contentview
hex_dump: Contentview
hex_stream: InteractiveContentview
msgpack: InteractiveContentview
protobuf: InteractiveContentview
grpc: InteractiveContentview
__all__ = [
"Contentview",
"InteractiveContentview",
"hex_dump",
"hex_stream",
"msgpack",
"protobuf",
"grpc",
"_test_inspect_metadata",
]

View File

@@ -0,0 +1,18 @@
from __future__ import annotations
from typing import final
@final
class DnsResolver:
def __init__(
self, *, name_servers: list[str] | None = None, use_hosts_file: bool = True
) -> None: ...
async def lookup_ip(self, host: str) -> list[str]: ...
async def lookup_ipv4(self, host: str) -> list[str]: ...
async def lookup_ipv6(self, host: str) -> list[str]: ...
def get_system_dns_servers() -> list[str]: ...
__all__ = [
"DnsResolver",
"get_system_dns_servers",
]

View File

@@ -0,0 +1,24 @@
from __future__ import annotations
from collections.abc import Awaitable, Callable
from typing import final
from . import Stream
async def start_local_redirector(
handle_tcp_stream: Callable[[Stream], Awaitable[None]],
handle_udp_stream: Callable[[Stream], Awaitable[None]],
) -> LocalRedirector: ...
@final
class LocalRedirector:
@staticmethod
def describe_spec(spec: str) -> None: ...
def set_intercept(self, spec: str) -> None: ...
def close(self) -> None: ...
async def wait_closed(self) -> None: ...
@staticmethod
def unavailable_reason() -> str | None: ...
__all__ = [
"start_local_redirector",
"LocalRedirector",
]

View File

@@ -0,0 +1,22 @@
from __future__ import annotations
from pathlib import Path
from typing import final
def active_executables() -> list[Process]: ...
def executable_icon(path: Path | str) -> bytes: ...
@final
class Process:
@property
def executable(self) -> Path: ...
@property
def display_name(self) -> str: ...
@property
def is_visible(self) -> bool: ...
@property
def is_system(self) -> bool: ...
__all__ = [
"active_executables",
"executable_icon",
"Process",
]

View File

@@ -0,0 +1,19 @@
from __future__ import annotations
from typing import Literal
def highlight(text: str, language: Literal["css", "javascript", "xml", "yaml", "none", "error"]) -> list[tuple[str, str]]:
pass
def languages() -> list[str]:
pass
def tags() -> list[str]:
pass
__all__ = [
"highlight",
"languages",
"tags",
]

View File

@@ -0,0 +1,24 @@
from __future__ import annotations
from collections.abc import Awaitable, Callable
from typing import final
from . import Stream
async def create_tun_interface(
handle_tcp_stream: Callable[[Stream], Awaitable[None]],
handle_udp_stream: Callable[[Stream], Awaitable[None]],
tun_name: str | None = None,
) -> TunInterface: ...
@final
class TunInterface:
def tun_name(self) -> str: ...
def close(self) -> None: ...
async def wait_closed(self) -> None: ...
def __repr__(self) -> str: ...
@staticmethod
def unavailable_reason() -> str | None: ...
__all__ = [
"create_tun_interface",
"TunInterface",
]

View File

@@ -0,0 +1,30 @@
from __future__ import annotations
from collections.abc import Awaitable, Callable
from typing import final
from . import Stream
async def start_udp_server(
host: str,
port: int,
handle_udp_stream: Callable[[Stream], Awaitable[None]],
) -> UdpServer: ...
@final
class UdpServer:
def getsockname(self) -> tuple[str, int]: ...
def close(self) -> None: ...
async def wait_closed(self) -> None: ...
def __repr__(self) -> str: ...
async def open_udp_connection(
host: str,
port: int,
*,
local_addr: tuple[str, int] | None = None,
) -> Stream: ...
__all__ = [
"start_udp_server",
"UdpServer",
"open_udp_connection",
]

View File

@@ -0,0 +1,29 @@
from __future__ import annotations
from collections.abc import Awaitable, Callable
from typing import final
from . import Stream
def genkey() -> str: ...
def pubkey(private_key: str) -> str: ...
async def start_wireguard_server(
host: str,
port: int,
private_key: str,
peer_public_keys: list[str],
handle_tcp_stream: Callable[[Stream], Awaitable[None]],
handle_udp_stream: Callable[[Stream], Awaitable[None]],
) -> WireGuardServer: ...
@final
class WireGuardServer:
def getsockname(self) -> tuple[str, int]: ...
def close(self) -> None: ...
async def wait_closed(self) -> None: ...
def __repr__(self) -> str: ...
__all__ = [
"genkey",
"pubkey",
"start_wireguard_server",
"WireGuardServer",
]