from mitmproxy import http def request(flow: http.HTTPFlow) -> None: # Content-Length 0 olan request body'yi kontrol et if flow.request.headers.get("Content-Length") == "0": # Yeni SOAP response body new_body = """ 2 InternetGatewayDevice.User.1.Password Xxxxx111.. InternetGatewayDevice.ManagementServer.EnableCWMP 0 InternetGatewayDevice.ManagementServer.URL http://your.acs.server.url 3 """ # Response body'yi değiştir def modify_response(): flow.response.text = new_body flow.response.headers["Content-Length"] = str(len(new_body)) # Response olduğunda modify_response fonksiyonunu çağır flow.intercept() flow.request.response = modify_response def response(flow: http.HTTPFlow) -> None: # Response olduğunda yukarıdaki modify_response fonksiyonunu çağırır if hasattr(flow.request, 'response') and callable(flow.request.response): flow.request.response()