- android系统https抓包问题分析
- 使用 mitmproxy 抓包
- Saving decoded Protobuf content
- **How to Centos Mitmproxy Installation and Configuration**
- **Installing the mitmproxy CA certificate manually**
- How to add Certificate Authority file in CentOS 7
-
Choosing upstream proxy during runtime depending on traffic contents
- 代理转发请求
mitmproxy -s request.py
import urllib3
import logging
import requests
from mitmproxy import http
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
logging.basicConfig(level=logging.INFO, format="%(asctime)s - %(message)s")
def request(flow: http.HTTPFlow) -> None:
proxy = "http://172.31.237.32:7890"
headers = {}
try:
r = requests.get(flow.request.pretty_url, headers=dict(flow.request.headers), proxies={"http":proxy, "https":proxy}, verify=False)
for key,value in r.headers.items():
headers[key.encode()] = value.encode()
except Exception as e:
logging.error(e)
flow.response = http.HTTPResponse.make(r.status_code, r.content, headers.items())
- 获取请求数据
mitmproxy -s response.py
import json
from mitmproxy import http
def response(flow: http.HTTPFlow) -> None:
if "search/notes?" in flow.request.url:
notes_list = json.loads(flow.response.text)["data"]["notes"]
- upstream代理转发 + 动态切换代理
mitmproxy -mode upstream:http://172.31.237.32:7890
proxy = ("127.0.0.1", 7890)
flow.live.change_upstream_proxy_server(proxy)