Skip to main content

Implement the core functions of mitmproxy based on playwright: request interception, response tampering

Project description

pwproxy


基于playwright实现mitmproxy的核心功能:请求拦截,响应篡改

优点

  1. 基于playwright,直接调用本地浏览器,不用以设置代理的方式启动浏览器, mitmproxy必须以冷启动设置代理的方法启动本地浏览器才能实现拦截
  2. 不需要考虑安全证书的问题

安装

pip install pwproxy

使用


目录结构:
├─run.py
├─demo.py
# run.py
from pwproxy.run import Run

Run.run("demo.py", url="http://example.com/")
# demo.py
from playwright.sync_api import Route


def replace_resp(route: Route):
    if "http://example.com/" in route.request.url:
        response = route.fetch()
        body = response.text()
        body = body.replace("Example Domain", "Goodo")
        route.fulfill(
            body=body
        )

addons = [
    replace_resp
]

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pwproxy-1.1.2.tar.gz (3.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pwproxy-1.1.2-py3-none-any.whl (4.1 kB view details)

Uploaded Python 3

File details

Details for the file pwproxy-1.1.2.tar.gz.

File metadata

  • Download URL: pwproxy-1.1.2.tar.gz
  • Upload date:
  • Size: 3.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.11.3

File hashes

Hashes for pwproxy-1.1.2.tar.gz
Algorithm Hash digest
SHA256 164d06703b50a2219f04e140e9a43f8da0dada1a1aee54494da174b6021c7001
MD5 2d690234054d917bc872e136f3766ee8
BLAKE2b-256 d37ce28b0d7dd3a55c1846fcf9c5cb0d6baf008995f5e87b99368b8743a76825

See more details on using hashes here.

File details

Details for the file pwproxy-1.1.2-py3-none-any.whl.

File metadata

  • Download URL: pwproxy-1.1.2-py3-none-any.whl
  • Upload date:
  • Size: 4.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.11.3

File hashes

Hashes for pwproxy-1.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 82a36cf8822566ff4ecac6c72ea846db7ed6d3b1dd8ccafb808733a566d10b74
MD5 ff7232a55c743ffe827d1e67bb8fbd30
BLAKE2b-256 3554dffa7c2eaa48b5590ec915555f532f5c3f3cc7a6001236888aa7561549e4

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page