From 571d36439cc2c0614564e711441570b382317c70 Mon Sep 17 00:00:00 2001 From: jay817 Date: Thu, 4 Dec 2025 20:57:28 +0900 Subject: [PATCH] Update mitmproxy/README.md --- mitmproxy/README.md | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/mitmproxy/README.md b/mitmproxy/README.md index 7fbbf4d..abffb20 100644 --- a/mitmproxy/README.md +++ b/mitmproxy/README.md @@ -1,3 +1,21 @@ +# `dump.py` +```python +I = lambda module: __import__('importlib').import_module(module) + +def request(flow): + with I('dbm.sqlite3').open('dbm.sql') as db: + if (url := flow.request.url) in db: + flow.response = I('mitmproxy.http').Response.make(200, db[url]) + +def response(flow): + if flow.response.status_code == 200: + with I('dbm.sqlite3').open('dbm.sql', 'c') as db: + db[flow.request.url] = flow.response.content + +if __name__ == '__main__': + I('subprocess').run(['mitmdump', '-s', __file__]) +``` + # Retries if failed ```python def response(flow):