in progress
This commit is contained in:
0
cpu-bench/bench.py
Executable file → Normal file
0
cpu-bench/bench.py
Executable file → Normal file
21
playwright/mitm.py
Normal file
21
playwright/mitm.py
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
from mitmproxy import http
|
||||||
|
import redis, json, base64
|
||||||
|
r = redis.Redis('192.168.12.2')
|
||||||
|
|
||||||
|
def response(flow: http.HTTPFlow) -> None:
|
||||||
|
# if not flow.request.url.endswith('.webp'):
|
||||||
|
# return
|
||||||
|
if not (200 <= flow.response.status_code < 300):
|
||||||
|
return
|
||||||
|
|
||||||
|
response_data = {
|
||||||
|
"status_code": flow.response.status_code,
|
||||||
|
"headers": dict(flow.response.headers),
|
||||||
|
"content": base64.b64encode(flow.response.content).decode('utf-8')
|
||||||
|
}
|
||||||
|
# JSON 문자열로 변환
|
||||||
|
response_json = json.dumps(response_data)
|
||||||
|
|
||||||
|
# Redis에 저장
|
||||||
|
r.hset('static', flow.request.url, response_json)
|
||||||
|
print(f"Cached response for {flow.request.url}")
|
||||||
Reference in New Issue
Block a user