Skip to main content

No project description provided

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-0.1.0.tar.gz (8.2 kB view details)

Uploaded Source

File details

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

File metadata

  • Download URL: pwproxy-0.1.0.tar.gz
  • Upload date:
  • Size: 8.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.8

File hashes

Hashes for pwproxy-0.1.0.tar.gz
Algorithm Hash digest
SHA256 6a632eb7ef8096ae5b4e092a9fdf962e003d865b3f4a1283a6b0e3b1390b7695
MD5 7e3e4f042fa20321a0a6eba7634a51d0
BLAKE2b-256 b33a486741716c295384c14016b37a58a54b07388eae4e434f4a41ec0b4a53ab

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