in progress

This commit is contained in:
Jaewook Lee
2024-09-01 14:47:40 +09:00
parent 6c5fcc5103
commit a5c579b67b
2 changed files with 21 additions and 0 deletions

0
cpu-bench/bench.py Executable file → Normal file
View File

21
playwright/mitm.py Normal file
View 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}")